谁能来帮帮我呀

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

Lanhening @ 2024-08-23 13:59:11

就差#3这一个点了


#include<iomanip>
#include<cmath>
using namespace std;
int main() {
    int T;
    cin >> T;
    if (T == 1) {
        cout << "I love Luogu!";
    } else if (T == 2) {
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        cout<<"3\n12\n2";
    } else if (T == 4) {
        double h;
        h=500.0/3.0;
        cout<<fixed<<setprecision(3);
        cout<<h;
    } else if (T == 5) {
        cout<<480/32;
    } else if (T == 6) {
        cout<<sqrt(6*6+9*9);
    } else if (T == 7) {
        cout<<"110\n90\n0";
    } else if (T == 8) {
        cout<<2*5*3.141593<<endl<<5*5*3.141593<<endl<<(double)4/3*3.141593*5*5*5;
    } else if (T == 9) {
       cout<<22;
    } else if (T == 10) {
        cout<<9;
    } else if (T == 11) {
        cout<<(double)100.0/3;
    } else if (T == 12) {
        cout<<13<<endl<<"R";
    } else if (T == 13) {
        double a,b,c;
        a=4.0/3.0*3.141593*4.0*4.0*4.0;
        b=4.0/3.0*3.141593*10.0*10.0*10.0;
        c=pow(a+b,3.0);
        cout<<(int)(c);
    } else if (T == 14) {
        cout<<50;
    }
    return 0;
}

by meifan666 @ 2024-08-23 14:00:49

@Lanhening 这样

else if (T == 3) {
   cout<<3<<endl<<12<<endl<<2;
}

by lpsz2024wcs @ 2024-08-23 14:02:25

@meifan666 是 #13


by 违规用户名K&xs3Z^ @ 2024-08-23 14:03:31

@Lanhening 计算有误

#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main() {
    int T;
    cin >> T;
    if (T == 1) {
        cout << "I love Luogu!";
    } else if (T == 2) {
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        cout<<"3\n12\n2";
    } else if (T == 4) {
        double h;
        h=500.0/3.0;
        cout<<fixed<<setprecision(3);
        cout<<h;
    } else if (T == 5) {
        cout<<480/32;
    } else if (T == 6) {
        cout<<sqrt(6*6+9*9);
    } else if (T == 7) {
        cout<<"110\n90\n0";
    } else if (T == 8) {
        cout<<2*5*3.141593<<endl<<5*5*3.141593<<endl<<(double)4/3*3.141593*5*5*5;
    } else if (T == 9) {
       cout<<22;
    } else if (T == 10) {
        cout<<9;
    } else if (T == 11) {
        cout<<(double)100.0/3;
    } else if (T == 12) {
        cout<<13<<endl<<"R";
    } else if (T == 13) {
        int r1=4,r2=10;
            double pi=3.141593;
            double v=4.0/3*pi*r1*r1*r1+4.0/3*pi*r2*r2*r2;
            v=pow(v,1.0/3);
            printf("%.0lf\n",v);
    } else if (T == 14) {
        cout<<50;
    }
    return 0;
}

by lpsz2024wcs @ 2024-08-23 14:07:11

@Lanhening

cout<<(int)pow(4.0/3*(3.141593*4*4*4+4/3*3.141593*10*10*10),1.0/3);

|