1 solutions

  • 0
    @ 2025-11-5 16:17:13

    C++ :

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        double cost,ans;
        cin>>cost;
        if(cost<=8)
        {
            ans=2.5*cost;
        }
        else
        {
            ans=2.5*8+(cost-8)*4;
        }
        printf("%.1lf\n",ans);
        return 0;
    }
    

    Pascal :

    var s,n:real;
    BEGIN
    	readln(n);
    	if n<=8 then s:=n*2.5 else s:=8*2.5+(n-8)*4;
    	writeln(s:0:1);
    END.
    
    • 1

    Information

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