1 solutions

  • 0
    @ 2025-3-3 16:34:00

    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

    Information

    ID
    10890
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By