5 条题解

  • 2
    @ 2024-2-27 21:10:06
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        if(n==1)cout<<5<<".0";
        else if(n>=2&&n<=5)printf("%.1f",4.5*n);
        else if(n>=6&&n<=10)cout<<4*n<<".0";
        else printf("%.1f",3.5*n);
        return 0;
    }
    

    点个赞呗!!!

    • 1
      @ 2023-10-2 8:25:15
      #include <iostream>
      #include <iomanip>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          if(n == 1)
          {
              cout << "5.0";
          }
          if(n >= 2 and n <= 5)
          {
              cout << fixed << setprecision(1) << n * 4.5;
          }
          if(n >= 6 and n <= 10)
          {
              cout << fixed << setprecision(1) << n * 4.0;
          }
          if(n > 10)
          {
              cout << fixed << setprecision(1) << n * 3.5;
          }
          return 0;
      }//已AC
      
      • -1
        @ 2022-12-16 22:36:07
        #include <iostream>//hetao3097453
        #include <iomanip>
        using namespace std;
        int main()
        {
            int n;
            cin >> n;
            if(n == 1)
            {
                cout << fixed << setprecision(1) << 1 * 5.0;
            }
            else if(n == 2 || n == 3 || n == 4 || n == 5)
            {
                cout << fixed << setprecision(1) << n * 4.5;
            }
            else if(n == 6 || n == 7 || n == 8 || n == 9 || n == 10)
            {
                cout << fixed << setprecision(1) << n * 4.0;
            }
            else
            {
                cout << fixed << setprecision(1) << n * 3.5;
            }
            return 0;
        }
        
        
        • -1
          @ 2022-8-17 11:21:15

          m=input() a=int(m) if a1: print(5.0) elif a>1 and a<6: a = 4.5 print(a) elif a>5 and a<10: print(a4.0) else: print(a*3.5) '''**注释: 因为本题要求保留一位小数, 在Python中,浮点数(一位)*整数仍得一位浮点数,所以可以把输入的瓶数乘以一位浮点数(如a9,a就乘以4.0),得到的就是一位浮点数,满足题意。

          '''

          • -2
            @ 2023-4-6 22:06:13
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
                double x;
                cin>>x;
                if (x==1)
                    cout<<fixed<<setprecision(1)<<5.0;
                else if (x<=5)
                    cout<<fixed<<setprecision(1)<<4.5*x;
                else if (x<=10)
                    cout<<fixed<<setprecision(1)<<4*x;
                else
                    cout<<fixed<<setprecision(1)<<3.5*x;
                return 0;
            }
            • 1

            信息

            ID
            714
            时间
            1000ms
            内存
            128MiB
            难度
            4
            标签
            递交数
            121
            已通过
            59
            上传者