4 条题解

  • 1
    @ 2022-12-24 17:13:19
    #include <iostream>
    using namespace std;
    int main()
    {
    	int a, b, c;
    	cin >> a;
    	if (a > 10)
    	{
    		b = 375 / 120;
    	    cout << b + 1;
        }
    	else if (a > 7)
    	{
    		c = 1.875;
    	   	cout << c + 1;
        }
    	else if (a > 3)
    	{
    		cout << "1.6";
    	}
    	return 0;
    }
    
    • 0
      @ 2023-4-3 21:51:32
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int x;
          cin>>x;
          if (x<=6)
              cout<<1;//直接自己算()
          else if (x<=10)
              cout<<2;
          else
              cout<<4;
          return 0;
      }
      
      • 0
        @ 2023-3-24 20:16:35
        #include <iostream>
        using namespace std;
        int main()
        {
            int n;
            cin >> n;
            if(n>10)
            {
                if(25*3*5%120==0)
                {
                    cout << 25*3*5/120;
                }
                else
                {
                    cout << 25*3*5/120+1;
                }
            }
            else if(n>=7)
            {
                if(15*3*5%120==0)
                {
                    cout << 15*3*5/120;
                }
                else
                {
                    cout << 15*3*5/120+1;
                }
            }
            else
            {
                if(5*3*5%120==0)
                {
                    cout << 5*3*5/120;
                }
                else
                {
                    cout << 5*3*5/120+1;
                }
            }
        }
        
        • 0
          @ 2023-2-20 13:36:08
          
              if(n <= 6)
              {
                  cout << "1";
              }
              else if(n <= 10)
              {
                  cout << "2";
              }
              else
              {
                  cout << "4";
              }
            
          
          

          这道题一定要用if-else if-else,否则就要写成

          n >= 3 && n <= 6

          hetao3097453

          2023年2月20日

          p307

          • 1

          【入门】至少要买几瓶止咳糖浆?

          信息

          ID
          307
          时间
          1000ms
          内存
          16MiB
          难度
          3
          标签
          递交数
          146
          已通过
          84
          上传者