1 条题解

  • 0
    @ 2023-3-13 11:07:16

    C :

    #include <stdio.h>
    int main(){
        int a;
        scanf("%d",&a);
        
       float q;
        if(a <= 10){
        	q = 2.5;
        }else{
        	q = 2.5 + (a-10) * 1.5;
        }
        
        printf("%.2f",q);
        return 0;
    }
    

    C++ :

    #include<iostream>
    #include<iomanip>
    using namespace std;
    int main(){
    	double x,i;
    	cin>>i;
    	if(i<=10){
    		x=2.5;
    	}else if(i>10){
    		x=2.5+(i-10)*1.5;
    	}
    	cout<<fixed<<setprecision(2)<<x<<endl;
    }
    

    Python :

    x = int( input() )
    if x <= 10:
        y = 2.5
    else:
        y = 2.5 +(x - 10) * 1.5
    
    print('%.2f' % y)
    
    
    
    
    • 1

    信息

    ID
    1299
    时间
    1000ms
    内存
    16MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者