9 条题解

  • 6
    @ 2023-8-26 17:13:06

    题解来啦(已AC) 点个赞o

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    
        int a,m,z;
        for(int a= 1;a <= 25;a++)
        {
            for(int m = 1;m <= 40;m++)
            {
                for(int z = 1;z <= 100;z++)
                {
                    if(a+ m + z == 100 && a * 5 + m * 3 + z / 3 == 100 && z % 3 == 0)
                    {
                        cout << a << " " << m << " " << z << endl;
                    }
                }
            }
        }
        return 0;
    }
    
  • 2
    @ 2023-9-14 21:59:47

    可以用枚举,但我懒,直接笔算最快(我不会说因为有人发枚举我才不发的

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        cout << "4 18 78" << endl << "8 11 81" << endl << "12 4 84";
    }
    
    • 2
      @ 2023-3-26 17:21:12

      全部枚举再判断是否符合条件

      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          for (int i=1;i<=20;i++)
          {
              for (int j=1;j<=33;j++)
              {
                  for (int k=1;k<=100;k++)
                  {
                      if (i*5+j*3+k==100&&i+j+k*3==100)
                      {
                          cout<<i<<" "<<j<<" "<<k*3<<'\n';
                      }
                  }
              }
          }
          return 0;
      }
      
      • 2
        @ 2023-3-20 13:34:13

        `

        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	double g,m;
        	for(g=1;g<=20;g++)
        	{
        		for(m=1;m<=33;m++)
        		{
        			if(g*5+m*3+(100-g-m)/3==100)
        			{
        				cout<<g<<" "<<m<<" "<<100-g-m<<"\n";
        			}
        		}
        	}
        }
        
        • 2
          @ 2022-12-6 14:45:56

          枚举就行拉

          #include <iostream>//hetao3097453
          using namespace std;
          int main()
          {
              int x,y,z;
              for(int x = 1;x <= 25;x++)
              {
                  for(int y = 1;y <= 40;y++)
                  {
                      for(int z = 1;z <= 100;z++)
                      {
                          if(x + y + z == 100 && x * 5 + y * 3 + z / 3 == 100 && z % 3 == 0)
                          {
                              cout << x << " " << y << " " << z << endl;
                          }
                      }
                  }
              }
              return 0;
          }
          
          • 1
            @ 2023-7-21 11:06:44
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
                for (int i=1;i*5<=100;i++) for (int j=1;j*3<=100;j++) if ((100-i-j)%3==0) if (i*5+j*3+(100-i-j)/3==100) cout << i << " " << j << " " << 100 - i - j << endl;
                return 0;
            }
            

            没有科技,全是狠活

            • 0
              @ 2024-5-8 21:00:52
              #include <bits/stdc++.h>
              using namespace std;
              int main(){
              	for (int i=1;i<=20;i++){
              		for (int j=1;j<=30;j++){
              			int k=100-i*5-j*3;
              			if (k*3+i+j==100)cout<<i<<" "<<j<<" "<<k*3<<endl;
              		}
              	}
              	return 0;
              }
              
              • 0
                @ 2024-3-10 15:59:03

                666啊

                • -2
                  @ 2022-8-17 18:52:50

                  枚举大法我直接吹爆:

                  #include <iostream>
                  #include <cstdio>
                  using namespace std;
                  int main()
                  {
                      for (int i=1;i*5<=100;i++)
                      {
                          for (int j=1;j*3<=100;j++)
                          {
                              if ((100-i-j)%3==0)//判断小鸡的数量是否是三的倍数,若是则是成立的小鸡数
                              {
                                  if (i*5+j*3+(100-i-j)/3==100)//判断三者之和是否等于100
                                  {
                                      cout<<i<<" "<<j<<" "<<100-i-j<<endl;
                                  }
                              }
                          }
                      }
                      return 0;
                  }
                  
                  • 1

                  信息

                  ID
                  15
                  时间
                  1000ms
                  内存
                  16MiB
                  难度
                  4
                  标签
                  递交数
                  336
                  已通过
                  150
                  上传者