5 solutions

  • 1
    @ 2025-12-16 21:57:42
    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int main()
    {
    	cin>>n;
    	cout<<((n%4)>=2)<<" "<<((n%4)%2)<<" "<<(n/4-(n%4>=1)-(n%4>=3));
    	return 0;
    }
    
    • -2
      @ 2025-3-16 14:44:57
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int a;
      	cin>>a;
      	if (a%4==0) cout<<0<<' '<<0<<' '<<a/4;
      	if (a%4==1) cout<<0<<' '<<1<<' '<<a/4-1;
      	if (a%4==2) cout<<1<<' '<<0<<' '<<a/4-1;
      	if (a%4==3) cout<<1<<' '<<1<<' '<<a/4-2;
      	return 0;
      }
      
      • -2
        @ 2024-11-9 15:00:14
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int n;
        	cin>>n;
        	int a=n/4;//可以买的4块的笔的数量
        	int r=n%4;//买了4块的笔以后剩余的笔的数量
        	int b=0,c=0;//b表示五块的笔,c表示六块的笔的数量 
        	switch(r)
        	{
        		case 1:
        			b=1,a--;
        			break;
        		case 2:
        			c=1,a--;
        			break;
        		case 3:
        			b=1,c=1,a-=2;
        			break; 
        	} 
        	cout<<c<<" "<<b<<" "<<a;
        	return 0;
        }
        
        • -3
          @ 2025-1-22 20:16:22
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int a,b,c,d,e,f,g,x,y,z;
              cin>>a;
              b=a/4;
              e=a%4;
              switch(e)
              {
                  case 0:
                  cout<<"0 0 "<<b;
                  break;
                  case 1:
                  cout<<"0 1 "<<b-1;
                  break;
                  case 2:
                  cout<<"1 0 "<<b-1;
                  break;
                  case 3:
                  cout<<"1 1 "<<b-2;
              }
              return 0;
          }
          
          • -3
            @ 2024-12-17 20:37:56
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
            	int x;
            	cin>>x;
            	int a=x/4;
            	int r=x%4;
                int b=0,c=0;
                switch(r)
                {
                	case 1:
                		b=1,a--;
                		break;
                	case 2:
            			c=1,a--;
            			break;
            		case 3:
            			b=1,c=1,a-=2;
            			break;
            	}
            	cout<<c<<" "<<b<<" "<<a;
            	return 0;
            }
            
            
            
            • 1

            Information

            ID
            42
            Time
            1000ms
            Memory
            256MiB
            Difficulty
            1
            Tags
            (None)
            # Submissions
            243
            Accepted
            89
            Uploaded By