1 solutions

  • 0
    @ 2025-11-5 16:18:32

    C++ :

    #include<cstdio>
    using namespace std;
    int main()
    {
    	double n,s,n1,n2;
    	scanf("%lf",&n);
    	if (n<=3) 
    	{
    	   s=10;
    	}
    	else 
    	{
    		if (n<=5)
    		{
    			s=10+(n-3)*1.8;
    		}
    		else 
    		{
    		    s=10+2*1.8+(n-5)*2.7;
    		}	
    	}
    	printf("%.2lf",s);
    	return 0;
    }
    

    Pascal :

    var
    n:real;
    begin
     read(n);
     if n=0  then write('0.00')
             else if (n>0) and (n<=3) then  write('10.00')
             else if (3<n) and (n<=5) then write(10+(n-3)*1.8:0:2)
                                      else write(10+(5-3)*1.8+(n-5)*2.7:0:2);
    end.
    
    • 1

    Information

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