11 条题解

  • 4
    @ 2022-1-10 12:03:39
    #include<iostream>
    #include <math.h>
    #include <cmath>
    using namespace std;
    int main()
    {
        int m,x,y,z,sum =0;
        cin >> m >> x>> y>> z;
        for (int i = 0; i <= m/x; i++)
        {
            for (int j = 0; j <= m; j++)
            {
                int l = m - i*x - j*y;
                if (i + j + l*z == m)
                {
                    cout << i << " "<< j << " "<< l*z << endl;
                    sum++;
                }
            }
        }   
    
        cout << sum;
    }
    
    • @ 2022-7-9 11:54:23

      #include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; for(int i = 3; i + 2 <= n ; i +=2) { int flag =1; for(int j = 2; jj <= i;j++) { if(i%j == 0) { flag = 0; break; } } if (flag == 0) continue; for(int j = 2 ; jj<=i+2; j++) { if((i+2)%j == 0) { flag = 0; break; } } if(flag == 1) { sum++; cout << i << " " << i + 2 << endl; } } if(sum == 0) { cout <<"empty\n"; } return 0; }

  • 2
    @ 2022-1-11 9:03:32
    #include <iostream>
    #include <math.h>
    #include <iomanip>
    using namespace std;
    #define LL Long Long
    const int N=1e5+10;
    const int INF=0x3f3f3f3f;
    int main()
    {
        int m,x,y,z,sum =0;
        cin >> m >> x>> y>> z;
        for (int i = 0; i <= m/x; i++)
        {
            for (int j = 0; j <= m; j++)
            {
                int l = m - i*x - j*y;
                if (i + j + l*z == m)
                {
                    cout << i << " "<< j << " "<< l*z << endl;
                    sum++;
                }
            }
        }   
        cout << sum;
    }
    
    • 2
      @ 2022-1-10 12:03:32
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int m,x,y,z,sum=0;
      	cin >>m>>x>>y>>z;
      	for(int i = 0; i <= m/x;i++)
      	{
      		for(int j = 0; j <= m/y;j++)
      		{
      			int l = m - i*x -j*y;
      			if(i + j + l*z == m)
      			{
      				cout << i << " " << j << " " << l*z << endl;
      				sum++;
      			}
      		}
      	}
      	cout << sum;
      }
      
      • 1
        @ 2022-1-10 12:04:20
        using namespace std;
        int main()
        {
        	int m,x,y,z,sum=0;
        	cin >>m>>x>>y>>z;
        	for(int i = 0; i <= m/x;i++)
        	{
        		for(int j = 0; j <= m/y;j++)
        		{
        			int l = m - i*x -j*y;
        			if(i + j + l*z == m)
        			{
        				cout << i << " " << j << " " << l*z << endl;
        				sum++;
        			}
        		}
        	}
        	cout << sum;
        }
        
        • 0
          @ 2025-12-28 22:50:55
          #include<bits/stdc++.h>
          using namespace std;
          
          int main(){
          	int m,x,y,z,s=0;
          	cin>>m>>x>>y>>z;
          	for(int i=0;i<=m/x;i++){
          		for(int j=0;j<=m/y;j++){
          			int k=m-i-j;
          			if(k%z==0&&i*x+j*y+k/z==m){
          				cout<<i<<" "<<j<<" "<<k<<"\n";
          				s+=1;
          			}
          		}
          	}
          	cout<<s;
          	return 0;
          }
          

          与众不同的AC代码

          • 0
            @ 2025-5-26 17:48:21

            #include using namespace std; int main() { int m, x, y, z; cin >> m >> x >> y >> z; int count = 0; for (int i = 0; i <= m; ++i) { for (int j = 0; j <= m - i; ++j) { int k = m - i - j; if (k % z != 0) continue; int totalCost = i * x + j * y + k / z; if (totalCost == m) { cout << i << " " << j << " " << k << endl; ++count; } } } cout << count << endl; return 0; }

            • 0
              @ 2024-6-14 19:58:57
              #include<bits/stdc++.h>
              using namespace std;
              int main()
              {
                  int m,x,y,z,sum =0;
                  cin >> m >> x>> y>> z;
                  for (int i = 0; i <= m/x; i++)
                  {
                      for (int j = 0; j <= m; j++)
                      {
                          int l = m - i*x - j*y;
                          if (i + j + l*z == m)
                          {
                              cout << i << " "<< j << " "<< l*z << endl;
                              sum++;
                          }
                      }
                  }   
              
                  cout << sum;
              }
              
              • 0
                @ 2022-7-9 11:43:53

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                //***************************

                //dev c++[[990.cpp]]*******

                //dev c++[top fanil]]******

                //dev c++*www.temege.com

                #include <stdio.h>

                #include

                #include <math.h>

                #include

                #include

                #include

                #include

                using namespace std;

                int main()

                {

                int m,x,y,z,sum=0;
                
                cin>>m>>x>>y>>z;
                
                for(int i=0;i<=m/x;i++)
                
                {
                
                	for(int j=0;j<=m;j++)
                
                	{
                
                		int l=m-i*x-j*y;
                
                		if(i+j+l*z==m)
                
                		{
                
                			cout<<i<<" "<<j<<" "<<l*z<<endl;
                
                			sum ++;
                
                		}
                
                	}
                
                }
                
                cout<<sum<<endl;
                
                return 0;
                

                }

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                ////////////////////////////

                • 0
                  @ 2022-7-8 18:27:28

                  #include <stdio.h>

                  #include

                  #include <math.h>

                  using namespace std;

                  int main()

                  {

                  int n,a,b,c,sum = 0;
                  
                  cin >> n >> a >> b >> c;
                  
                  for(int i = 0 ; i <= n/a; i++)
                  
                  {
                  
                  	for(int j = 0; j <= n/b ; j++)
                  
                  	{
                  
                  		for(int k = 0; k <= n; k++)
                  
                  		{
                  
                  			if(a*i + b*j + k == n && i + j + k*c 
                              == n)
                  			
                              {
                  			
                              	cout << i << " " << j << " " << k*c << endl;
                  
                  
                  				sum++;
                  			
                              }
                  		}
                  
                  	}
                  
                  } 	
                  
                  
                  cout << sum << endl;
                  
                  return 0;
                  

                  }

                  • -2
                    @ 2026-1-9 17:23:39
                    #include <iostream>
                    using namespace std;
                    int k;
                    int main()
                    {
                        cin >> k;
                        long long anssss = 0;
                        int a = 1,day = 1;//a为每天的工资
                        for (int i = 1;i <= k;i++)
                        {
                            anssss += a;
                            day--;
                            if (day == 0)
                            {
                                a++;
                                day = a;
                            }
                        }
                        cout << anssss;
                        return 0;
                    }//不是AI写的
                    • -2
                      @ 2025-12-28 13:54:12
                      #include <iostream>
                      using namespace std;
                      short ans;
                      int main()
                      {
                      	int m,x,y,z;
                      	cin >> m >> x >> y >> z;
                      	for (int i = 0;i <= m / x;i++)
                      	{
                      		for (int j = 0;j <= m;j++)
                      		{
                      			int mon = m - i * x - j * y;
                      			if (mon * z + i + j == m)
                      			{
                      				cout << i << ' ' << j << ' ' << mon * z << endl;
                      				ans++;
                      			}
                      		}
                      	}
                      	cout << ans;
                      	return 0;
                      }
                      • 1

                      信息

                      ID
                      924
                      时间
                      1000ms
                      内存
                      128MiB
                      难度
                      4
                      标签
                      递交数
                      695
                      已通过
                      312
                      上传者