1 solutions

  • 0
    @ 2025-11-5 16:20:22

    C :

    #include <stdio.h>
    void main()
    {
    	float x,y;
    	scanf("%f",&x);
    	if(x<=3)
    		y=10;
    	else if(x>3&&x<=5)
    		y=10+(x-3)*1.8;
    	else 
    		y=13.6+(x-5)*2.7;
    	printf("%.2f\n",y);
    }
    

    C++ :

    #include<iostream>
    #include<cstdio>
    using namespace std;
    
    int main()
    {
    	double a;
    	cin>>a;
    	if (a<=3.0) printf("%.2lf",10.004);
    	if (a>3.0&&a<=5.0)  printf("%.2lf",10.00+((a-3.0)*1.8));
    	if (a>5.0) printf("%.2lf",13.6+((a-5.0)*2.7));
    	return 0;
    }
    

    Pascal :

    var a,b:real;
    begin
      readln(a);
      if a<=3 then b:=10;
      if (a>3) and (a<=5) then b:=(a-3)*1.8+10;
      if a>5 then b:=2*1.8+(a-5)*2.7+10;
      writeln(b:0:2);
    end.
    
    

    Python :

    # coding=utf-8
    a = float(input())
    if a <= 3 :
        t = 10
    elif a <= 5 :
        t = 10 + (a - 3) * 1.8
    else :
        t = 13.6 + (a - 5) * 2.7
    print(format(t, ".2f"))
    
    
    • 1

    Information

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