9 条题解

  • 3
    @ 2023-5-9 19:34:17
    #include<iostream>
    #include<iomanip>
    using namespace std;
    int main() {
        double n, sum;
        cin >> n;
        if (n >= 0 && n <= 150) sum = n * 0.4463;
        if (n > 150 && n <= 400) sum = 150 * 0.4463 + (n - 150) * 0.4663;
        if (n > 400) sum = 150 * 0.4463 + 250 * 0.4663 + (n - 400) * 0.5663;
        cout << fixed << setprecision(1) << sum;
        return 0;
    }
    
    • 1
      @ 2024-3-2 21:36:45

      #include <bits/stdc++.h> using namespace std; int main() { double n,a; cin>>n; if(n>=0&&n<=150)a=n0.4463; if(n>150&&n<=400)a=1500.4463+(n-150)0.4663; if(n>400)a=1500.4463+250*0.4663+(n-400)*0.5663; cout<<fixed<<setprecision(1)<<a; return 0; }

      • 1
        @ 2023-10-24 23:21:56

        CPP

        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
            int i;
            cin>>i;
            if (i <= 150)
            {
                printf("%.1f",i*0.4463);
            }
            else if (i >= 151 && i <= 400)
            {
                printf("%.1f",150*0.4463+(i-150)*0.4663);
            }
            else if (i >= 401)
            {
                printf("%.1f",150*0.4463+250*0.4663+(i-400)*0.5663);
            }
            return 0;
        }
        
        • 1
          @ 2023-10-22 8:16:55

          if 基础语句

          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int i;
              cin>>i;
              if (i <= 150)
              {
                  printf("%.1f",i*0.4463);
              }
              else if (i >= 151 && i <= 400)
              {
                  printf("%.1f",150*0.4463+(i-150)*0.4663);
              }
              else if (i >= 401)
              {
                  printf("%.1f",150*0.4463+250*0.4663+(i-400)*0.5663);
              }
              return 0;
          }
          
          • 0
            @ 2023-4-29 12:58:59
            #include <bits/stdc++.h>
            using namespace std;
            int main() {
                const double aTierUnitCost = 0.4463, bTierUnitCost = 0.4663, cTierUnitCost = 0.5663;
                int a;
                cin >> a;
                if(a <= 150) {
                    cout << fixed << setprecision(1) << a * aTierUnitCost << endl; 
                } else if(a <= 400) {
                    cout << fixed << setprecision(1) << 150 * aTierUnitCost + (a - 150) * bTierUnitCost << endl;
                } else {
                    cout << fixed << setprecision(1) << 150 * aTierUnitCost + 250 * bTierUnitCost + (a - 400) * cTierUnitCost << endl;
                }
                return 0;
            }
            

            C 风格输入输出写法

            #include <bits/stdc++.h>
            using namespace std;
            int main() {
                const double aTierUnitCost = 0.4463, bTierUnitCost = 0.4663, cTierUnitCost = 0.5663;
                int a;
                cin >> a;
                if(a <= 150) {
                    printf("%.1lf", a * aTierUnitCost);
                } else if(a <= 400) {
                    printf("%.1lf", 150 * aTierUnitCost + (a - 150) * bTierUnitCost);
                } else {
                    printf("%.1lf", 150 * aTierUnitCost + 250 * bTierUnitCost + (a - 400) * cTierUnitCost);
                }
                return 0;
            }
            
            • -1
              @ 2023-4-8 15:52:46
              #include <bits/stdc++.h>
              using namespace std;
              
              int main()
              {
                  int n; cin >> n;
                  double s = 0;
                  if(n <= 150) 
                      s = 0.4463 * n;
                  else if(n <= 400) 
                      s = 0.4463 * 150 + (n - 150) * 0.4663;
                  else
                      s = 0.4463 * 150 + (400 - 150) * 0.4663 + (n - 400) * 0.5663;
                  cout << fixed << setprecision(1) <<s;
              }
              
              • -2
                @ 2021-12-18 19:16:56
                #include <iostream>
                using namespace std;
                int main(){
                    int a=0;
                    double b=0;
                    cin>>a;
                    if(a<=150){
                        b = a*0.4463;
                    }
                    else if(a>=151&&a<=400){
                        b += 150*0.4463;
                        b += (a-150)*0.4663;
                    }
                    else{
                        b += 150*0.4463;
                        b += (400-150)*0.4663;
                        b += (a-400)*0.5663;
                    }
                    b=int((b*10)+0.5)/10.0;
                    cout<<b<<endl;
                }
                
                • -3
                  @ 2022-6-5 10:12:19
                  #include<bits/stdc++.h>
                  using namespace std;
                  double a,b,c,n,x,y;
                  int main()
                  {
                      cin>>x;
                      if(x<=150)
                      x*=0.4463;
                      else if(x<=400)
                      x=150*0.4463+(x-150)*0.4663;
                      else
                      x=150*0.4463+250*0.4663+(x-400)*0.5663;
                      printf("%0.1f",x);
                      return 0;
                  }
                  
                  • -3
                    @ 2021-9-20 13:14:42

                    #include <iostream> using namespace std; double cost[10005];//代表第i度电的花费 int a; double b; int main() { int i; cin>>a; for(i=1;i<=150;i++) cost[i]=0.4463; for(i=151;i<=400;i++) cost[i]=0.4663; for(i=401;i<=10000;i++) cost[i]=0.5663; for(i=1;i<=a;i++) b+=cost[i]; b=int((b*10)+0.5)/10.0; cout<<b<<endl; return 0; }

                    • 1

                    信息

                    ID
                    422
                    时间
                    1000ms
                    内存
                    125MiB
                    难度
                    1
                    标签
                    (无)
                    递交数
                    399
                    已通过
                    200
                    上传者