4,8,13wa!!!

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

sans_001 @ 2024-01-29 08:55:30

#include <bits/stdc++.h>
using namespace std;
int main() {
    int T;
    double pie=3.141593;
    cin >> T;
    if (T == 1) {
        cout << "I love Luogu!";
    } else if (T == 2) {
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        printf("%d\n%d\n%d\n",3,12,2);
    } else if (T == 4) {
        cout<<fixed<<setprecision(6)<<500/3;
    } else if (T == 5) {
        cout<<480/32;
    } else if (T == 6) {
        cout<<sqrt(36+81);
    } else if (T == 7) {
        printf("%d\n%d\n%d\n",110,90,0);
    } else if (T == 8) {
        printf("%f\n%f\n%f\n",10*pie,25*pie,0.75*pie*125);
    } else if (T == 9) {
        cout<<22;
    } else if (T == 10) {
        cout<<9;
    } else if (T == 11) {
        printf("%.4f",100.0/3);
    } else if (T == 12) {
        cout<<13<<endl<<"R"<<endl;
    } else if (T == 13) {
        double s = 4.0 / 3 * 64 * pie + 4.0 / 3 * 1000 *pie;
        cout<<pow(s,1.0/3);
    } else if (T == 14) {
        cout<<50;
    }
    return 0;
}

救救我!!! 膜拜大佬!!!


by __PRO__ @ 2024-01-29 09:08:03

@okkkkkkkkk


by sans_001 @ 2024-01-29 15:28:14

@PRO 十分感谢!可是我的#8依然wa掉了。 希望能够再次指教一下!!!

代码如下:

#include <bits/stdc++.h>
using namespace std;
int main() {
    int T;
    double pie=3.141593;
    cin >> T;
    if (T == 1) {
        cout << "I love Luogu!";
    } else if (T == 2) {
        cout << 2 + 4 << " " << 10 - 2 - 4;
    } else if (T == 3) {
        printf("%d\n%d\n%d\n",3,12,2);
    } else if (T == 4) {
        printf("%.3f",(double)500/3);
    } else if (T == 5) {
        cout<<480/32;
    } else if (T == 6) {
        cout<<sqrt(36+81);
    } else if (T == 7) {
        printf("%d\n%d\n%d\n",110,90,0);
    } else if (T == 8) {
        cout<<10*pie<<25*pie<<0.75*pie*125;
    } else if (T == 9) {
        cout<<22;
    } else if (T == 10) {
        cout<<9;
    } else if (T == 11) {
        printf("%.4f",100.0/3);
    } else if (T == 12) {
        cout<<13<<endl<<"R"<<endl;
    } else if (T == 13) {
        double s = 4.0 / 3 * 64 * pie + 4.0 / 3 * 1000 *pie;
        cout<<floor(pow(s,1.0/3));
    } else if (T == 14) {
        cout<<50;
    }
    return 0;
}

by __PRO__ @ 2024-01-29 15:32:28

@sans_001 体积公式:

\frac{4}{3}\pi r^3\ne0.75\pi r^3

by jessie_liu @ 2024-02-27 18:46:58

#include<bits/stdc++.h>  
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) {

        int a=14/4;
        cout<<a<<endl;
        cout<<a*4<<endl;
        cout<<14-a*4<<endl;
    } else if (T == 4) {

        cout<<500.0/3<<endl;
    } else if (T == 5) {

        cout<<(260+220)/(12+20)<<endl;
    } else if (T == 6) {

        double a=6,b=9;
        double c=sqrt(a*a+b*b);
        cout<<c<<endl;
    } else if (T == 7) {

        int a=100;
        a+=10;  
        cout<<a<<endl;
        a-=20;  
        cout<<a<<endl;
        a=0;  
        cout<<a<<endl;
    } else if (T == 8) {

        int r=5;
        double pi=3.141593;
        cout<<2*pi*r<<endl;
        cout<<r*r*pi<<endl;
        cout<<4.0/3*pi*r*r*r<<endl;
    } else if (T == 9) {

        cout<<(((1+1)*2+1)*2+1)*2<<endl;
    } else if (T == 10) {

        cout<<9<<endl;
    } else if (T == 11) {

        cout<<100.0/(8-5)<<endl;
    } else if (T == 12) {

        cout<<'M'-'A'+1<<endl;
        cout<<char('A'-1+18)<<endl;
    } 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<<endl;
    }
   return 0;
}

by YJXYDWZ @ 2024-08-21 10:20:16

@PRO 8题公式感觉不对啊狗头


by YJXYDWZ @ 2024-08-21 10:21:59

@YJXYDWZ 我好像来玩了


|