1 solutions

  • 0
    @ 2025-11-5 15:21:56

    C :

    #include <stdio.h>
    
    int main() {
        float x;
        scanf("%f", &x);
        if (x >= 1 && x < 10) {
            x = 2 * x - 1;
        } else if (x >= 10){
            x = 3 * x - 11;
        }
        printf("%.2f\n", x);
        return 0;
    }
    

    C++ :

    #include <stdio.h>
    int a[100000];
    int main()
    {
    	double x;
    	while(scanf("%lf",&x)!=EOF)
    	{
    		if(x<1)
    		printf("%.2lf\n",x);
    		if(x>=1&&x<10)
    		printf("%.2lf\n",2*x-1);
    		else
    		printf("%.2lf\n",3*x-11);
    	}
    	return 0;
    }
    
    • 1

    Information

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