这个代码有问题吗!

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

Motbloveut221 @ 2020-04-28 20:16:08

#include<iostream>
#include<cmath>
// 填上你觉得需要的其他头文件
const double PI = 3.141593;
using namespace std;
int main() {
    int T;
    cin >> T;
    if (T == 1) {
        // 粘贴问题 1 的主函数代码,除了 return 0
        cout << "I love Luogu!";
    } else if (T == 2) {
        // 粘贴问题 2 的主函数代码,除了 return 0
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        cout << 3 << endl;
        cout << 12 << endl;
        cout << 2;
    } else if (T == 4) {
        cout << 166.667;
    } else if (T == 5) {
        cout << 20;
    } else if (T == 6) {
        cout << (int)(sqrt(36+81));
    } else if (T == 7) {
        int a=100;
        a+=10;
        cout << a << endl;
        a-=20;
        cout << a << endl;
        cout << 0;
    } else if (T == 8) {
        cout << PI*2*5 << endl << PI*5*5 << endl << 4/3*PI*5*5*5;
    } else if (T == 9) {
        int a=1;
        a++;
        a*=2;
        a++;
        a*=2;
        a++;
        a*=2;
        cout << a;
    } else if (T == 10) {
        cout << 9;
    } 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 << 50;
    }
    return 0;
}

by xiaomic @ 2020-04-28 20:16:53

没问题为什么要发帖


by AgrumeStly @ 2020-04-28 20:17:10

有问题


by ZZ_peng09 @ 2020-04-28 20:18:22

直接打表


by xiaomic @ 2020-04-28 20:21:09

T5是15@刀锋上的人


by duyh1114 @ 2020-04-28 20:21:39

T5您是怎么算出来的20


by duyh1114 @ 2020-04-28 20:22:48

您的5,6,8,11都错了呢


by Motbloveut221 @ 2020-04-28 20:22:49

@duyh1114 emmmm


by xiaomic @ 2020-04-28 20:23:28

6不能int吧


by Motbloveut221 @ 2020-04-28 20:26:54

#include<iostream>
#include<cmath>
// 填上你觉得需要的其他头文件
const double PI = 3.141593;
using namespace std;
int main() {
    int T;
    cin >> T;
    if (T == 1) {
        // 粘贴问题 1 的主函数代码,除了 return 0
        cout << "I love Luogu!";
    } else if (T == 2) {
        // 粘贴问题 2 的主函数代码,除了 return 0
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        cout << 3 << endl;
        cout << 12 << endl;
        cout << 2;
    } else if (T == 4) {
        cout << 166.667;
    } else if (T == 5) {
        cout << 15;
    } else if (T == 6) {
        cout << sqrt(36+81);
    } else if (T == 7) {
        int a=100;
        a+=10;
        cout << a << endl;
        a-=20;
        cout << a << endl;
        cout << 0;
    } else if (T == 8) {
        cout << PI*2*5 << endl << PI*5*5 << endl << (4.0/3)*PI*5*5*5;
    } else if (T == 9) {
        int a=1;
        a++;
        a*=2;
        a++;
        a*=2;
        a++;
        a*=2;
        cout << a;
    } else if (T == 10) {
        cout << 9;
    } 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 << 50;
    }
    return 0;
}

T11不知道错在哪


by Motbloveut221 @ 2020-04-28 20:27:15

@xiaomic 谢谢


| 下一页