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

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

witherbogged @ 2023-10-30 21:21:51

93分,求帮助

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main() {
    int a, pi;
    cin >> a;
    pi = 3.141593;
    if (a==1) {
        cout << "I love Luogu!" << endl;
    } 
    if (a==2) {
        cout << 2+4 << " " << 10-2-4 << endl;
    } 
    if (a==3) {
        cout << 14/4 << endl;
        cout << 14/4*4 << endl;
        cout << 14-14/4*4 << endl;
    } 
    if (a==4) {
        printf ("%.3f\n",500.0/3);
    } 
    if (a==5) {
        cout << (260+220)/(12+20) << endl;
    } 
    if (a==6) {
        cout << sqrt(6*6+9*9) << endl;
    } 
    if (a==7) {
        cout << 100+10 << endl;
        cout << 100+10-20 << endl;
        cout << 0 << endl;
    } 
    if (a==8) {
        cout << 2*5*pi << endl;
        cout << 5*5*pi << endl;
        cout << 4*5*5*5*pi/3 << endl;
    } 
    if (a==9) {
        int n;
        n = 1;
        for (int i=0; i<3; i++) {
            n = (n+1)*2;
        }
        cout << n << endl;
    } 
    if (a==10) {
        double p, s, e;
        p = (8*30-10*6)*1.0/(30-6);
        s = 8*30-30*p;
        e = s+10*p;
        cout << e/10 << endl;
    } 
    if (a==11) {
        cout << 100.0/(8-5) << endl;
    } 
    if (a==12) {
        cout << 'M'-'A'+1 << endl;
        cout << char('A'+18-1) << endl;
    } 
    if (a==13) {
        int v;
        v = 4*4*4*4*pi/3+10*10*10*4*pi/3;
        cout << int(cbrt(v)) << endl;
    } 
    if (a==14) {
        int p, v, i;
        for (i=1; i<120; i++) {
            p = 10+110-i;
            v = p*i;
            if (v==3500) {
                break;
            }
        }
        cout << i << endl;
    }
    return 0;
}

by Typed_SIGTERM @ 2023-10-30 21:34:47

pi int


by witherbogged @ 2023-10-30 21:37:00

已改,感谢


|