你真的是xx数学吗,我是xxs(自爆),我自己都不太会做

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

zhenshijuruo @ 2024-09-28 17:22:02

求调,这是旧题重刷,依旧是79分

代码如下:

#include<bits/stdc++.h>
using namespace std;
const double pi=3.14159;
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<<14/4<<endl<<14/4*4<<endl<<14-14/4*4;
    } else if (T == 4) {
        printf("%.3lf",500/3);
    } else if (T == 5) {
        cout<<(220+260)/(20+12);
    } else if (T == 6) {
        cout<<sqrt(6*6+9*9);
    } else if (T == 7) {
        cout<<100+10<<endl<<100+10-20<<endl<<100+10-20-(100+10-20);
    } else if (T == 8) {
        double r=5;
        cout<<pi*10<<endl<<pi*25<<endl<<4/3*pi*125<<endl;
    } else if (T == 9) {
        cout<<(((1+1)*2+1)*2+1)*2;
    } else if (T == 10) {
        cout<<(15+7.5*10)/10;
    } else if (T == 11) {
        cout<<1.0*100/3;
    } else if (T == 12) {
        cout<<13<<endl<<'R';
    } else if (T == 13) {
        cout<<(int)(pow(4/3*pi*(4*4*4+10*10*10),1.0*1/3));
    } else if (T == 14) {
        cout<<110-60;
    }
    return 0;
}

by zhongjisailuo @ 2024-09-28 17:28:03

@zhenshijuruo 哪道题


by __O_w_O__ @ 2024-09-28 17:30:37

@zhongjisailuo 这道题


by zhongjisailuo @ 2024-09-28 17:33:24

???


by zhongjisailuo @ 2024-09-28 17:33:40

哪个


by MichaelMao @ 2024-09-28 17:45:21

@zhongjisailuo 在这里


by dacongming123 @ 2024-10-04 10:41:07

@MichaelMao 他是问你哪道小题出错了


by dacongming123 @ 2024-10-04 10:47:23

我帮你改一改:

#include<bits/stdc++.h>
using namespace std;
const double pi=3.14159;
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<<14/4<<endl<<14/4*4<<endl<<14-14/4*4;
    } else if (T == 4) {
        printf("%.3lf",500/3);//问题所在,应该是500.0/3才会得到小数
    } else if (T == 5) {
        cout<<(220+260)/(20+12);
    } else if (T == 6) {
        cout<<sqrt(6*6+9*9);
    } else if (T == 7) {
        cout<<100+10<<endl<<100+10-20<<endl<<100+10-20-(100+10-20);
    } else if (T == 8) {
        double r=5;
        cout<<pi*10<<endl<<pi*25<<endl<<4/3*pi*125<<endl;//又错了,4.0/3
    } else if (T == 9) {
        cout<<(((1+1)*2+1)*2+1)*2;
    } else if (T == 10) {
        cout<<(15+7.5*10)/10;
    } else if (T == 11) {
        cout<<1.0*100/3;//这个你到没错
    } else if (T == 12) {
        cout<<13<<endl<<'R';
    } else if (T == 13) {
        cout<<(int)(pow(4/3*pi*(4*4*4+10*10*10),1.0*1/3));//.0.0都说了需要.0
    } else if (T == 14) {
        cout<<110-60;
    }
    return 0;
}

求关


by dacongming123 @ 2024-10-04 10:55:40

还有:

问题 8

当半径为 r=5,请输出圆的周长、面积和球体积。取π=3.141593。请直接使用 cout 输出答案,每行一个数字。

π为

3.141593!!!


by zhenshijuruo @ 2024-10-06 21:52:32

@dacongming123 谢谢,修正过来了


by zhenshijuruo @ 2024-10-06 21:53:01

此帖结


|