79分求助

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

BrandonLee @ 2023-08-25 10:31:21

8 #11 #13错误

#include <bits/stdc++.h>
#include <cstdio>
#include <sstream>
#include <algorithm>
#include <iostream>

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 << endl << 12 << endl << 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) {
        cout << 110 << endl << 90 << endl << 0;
    } else if (T == 8) {
        cout << 3.141593*10 << endl << 3.141593*25 << endl;
        cout << 4 / 3 * 3.141593 * 5 * 5 * 5;
    } else if (T == 9) {
        cout << 22;
    } else if (T == 10) {
        cout << 9;
    } else if (T == 11) {
        cout << 100/3;
    } else if (T == 12) {
        cout << 13 << endl << 'R';
    } else if (T == 13) {
        double a = 4 / 3 * 3.141593 * 4 * 4 * 4;
        double b = 4 / 3 * 3.141593 * 10 * 10 * 10;
        double sum = a + b;
        printf("%.0lf",sqrt(sqrt(sum)));
    } else if (T == 14) {
        cout << 50;
    }
    return 0;
}

by WYZ20030051 @ 2023-08-25 10:33:36

是你精度炸了,你应该把4写成4.0


by WYZ20030051 @ 2023-08-25 10:34:16

也就是把被除数写成4.0


by FurippuWRY @ 2023-08-25 10:36:43

@BrandonLee
8 cout<<3.141593*10<<endl<<78.5398<<endl<<523.599<<endl;
11
cout<<1.0*100/3;
13
cout<<16;
如果有帮助就给个关注吧谢谢喵!


by BrandonLee @ 2023-08-25 10:55:26

@FurippuWRY @WYZ20030051

好的,谢谢 (^_^)


|