5 条题解

  • 1
    @ 2025-2-25 22:59:18

    非常简单

    考点如下:

    1. 输出小数
    2. if结构
    3. 加减乘除

    求点赞!!!

    上AC代码

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int a;
    	cin>>a;
    	double ans=0;
    	if (a<=150) ans=0.4463*a;
    	else if (a>150 && a<=400) ans=a*0.4463+0.02*(a-150);
    	else if (a>400) ans=a*0.4463+0.02*(a-150)+0.1*(a-400);
    	printf("%.1f\n",ans);
        return 0;
    }
    
    • 0
      @ 2025-3-31 9:23:08

      import java.util.Scanner;

      public class Main2 { public static void main(String[] args) { //输入你所耗费的电费 Scanner sc = new Scanner(System.in); int a = sc.nextInt();

          if (a <= 150) {
              System.out.println(String.format("%.1f",a * 0.4463));
          } else if (a <= 400) {
              System.out.println(String.format("%.1f", 150 * 0.4463 + (a - 150) * 0.4663));
          } else  {
              System.out.println(String.format("%.1f",150 * 0.4463 + 250 * 0.4663 + (a - 400) * 0.5663));
          }
      }
      

      }

      • 0
        @ 2025-2-7 22:54:55
        num = int(input())
        price = 0.0
        if num<=150:
            price += num*0.4463
        else:
            price += 150*0.4463 # 小于150的部分
            num -= 150
            if num<=250:
                price += num*0.4663
            else:
                price += 250*0.4663
                num -= 250
                price += num*0.5663
        print(f"{price:.1f}")
        
        
        • 0
          @ 2024-11-1 18:45:47
          #include<bits/stdc++.h>
          using namespace std;
          int main(){
              double e,money=0;
              cin>>e;
              if(e<=150)	
                  money=e*0.4463;
              if(e>150||e==400)	
                  money=150*0.4463+(e-150)*0.4663;
              if(e>400)		
                  money=150*0.4463+250*0.4663+(e-400)*0.5663;
              printf("%.1lf\n",money);
              return 0;
          }
          
          • -1
            @ 2024-11-10 10:38:08
            #include<bits/stdc++.h>
            using namespace std;
            int main(){
            	int n;
            	cin>>n;
            	if(n<=150)cout<<fixed<<setprecision(1)<<n*0.4463;
            	else if(n>=150&&n<=400)cout<<fixed<<setprecision(1)<<150*0.4463+(n-150)*0.4663;
            	else cout<<fixed<<setprecision(1)<<150*0.4463+250*0.4663+(n-400)*0.5663;
            	return 0;
            }
            
            • 1

            信息

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