72分,求助哪里错了

P2433 【深基1-2】小学数学 N 合一

Yu09217777 @ 2022-07-19 16:43:05

#include <bits/stdc++.h>
using namespace std;
int main(){
    //有错 72分 
    int q;
    cin >> q;
    if (q == 1){
        cout << "I love Luogu!";
    }else if (q == 2){
        int s,c;
        s = 2 + 4;
        c = 10 - s; 
        cout << s << " " << c;
    }else if (q == 3){
        int m,n,sum;
        m = 14 / 4;
        sum = 4 * m;
        n = 14 % 4;
        cout << m << endl;
        cout << sum << endl;
        cout << n << endl; 
    }else if (q == 4){
        double n;
        n = 500 / 3;
        cout << fixed << setprecision(3) << n;
    }else if (q == 5){
        int t;
        t = (260 + 220) / (12 + 20);
        cout << t;      
    }else if (q == 6){
        cout << sqrt (6 * 6 + 9 * 9);
    }else if (q == 7){
        int a,b,c;
        a = 100 + 10;
        b = a - 20;
        c = 0;
        cout << a << endl;
        cout << b << endl;
        cout << c << endl; 
    }else if (q == 8){
        const double pi = 3.14159;
        cout << pi * 5 * 2 << " " << 5 * 5 * pi << " " << 4 / 3 * pi * 5 * 5 * 5; 
    }else if (q == 9){
        int sum;
        sum = (((1 + 1) * 2 + 1) * 2 + 1) * 2;
        cout << sum;
    }else if (q == 10){
        cout << (15 + 7.5 * 10) / 10;
    }else if (q == 11){
        cout << 100 / (8 - 5);
    }else if (q == 12){
        int m;
        char x;
        m = 'M'- 65 + 1;
        x = 65 + 18 - 1;
        cout << m << endl;
        cout << x << endl;
    }else if (q == 13){
        double y1,y2,sum,pi = 3.14159;
        y1 = 4 * 4 * 4 * 4 / 3 * pi;
        y2 = 10 * 10 * 10 * 4 / 3 * pi;
        sum = y1 + y2;
        cout << pow (sum,1 / 3 * 1.0);
    }else if (q == 14){
        cout << 50;
    }
    return 0;
}

by Not_lazy @ 2022-10-29 20:26:48

题解


上一页 |