求助

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

taikongsa @ 2024-08-17 23:26:52

#include<iostream>

using namespace std;

int main() 

{

    int T;

    cin >> T;

    if (T == 1) 
    {
        cout<<"I love Luogu!"<<endl; 
    } 
    else if (T == 2) 
    {
        cout<<2+4<<" "<<10-2-4<<endl;
    }
    else if (T == 3)
    {
        int e=14/4;

        cout<<e<<endl;
        cout<<e*4<<endl;
        cout<<14-e*4<<endl;
    } 
    else if (T == 4)
    {
        cout<<500.0/3<<endl;
    } 
    else if (T == 5) 
    {
        cout<<(260+220)/(12+20)<<endl;
    }
    else if (T == 9) 
    {
        cout<<(((1+1)*2+1)*2+1)*2<<endl;
    } 
    else if (T == 6) 
    {
        double d=6,b=9;
        double c=d*d+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 i=3.141593;

        cout<<2*i*r<<endl;
        cout<<r*r*i<<endl;
        cout<<4.0/3*i*r*r*r<<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) 
    {
        cout << 16 << endl;
    } 
    else if (T == 14)
    {
        cout<<50<<endl;
    }
    return 0;
}

by are_you_sure @ 2024-08-17 23:49:35

@taikongsa

#include<iostream>
#include<cmath>//去掉就ce
using namespace std;

int main() 

{

    int T;

    cin >> T;

    if (T == 1) 
    {
        cout<<"I love Luogu!"<<endl; 
    } 
    else if (T == 2) 
    {
        cout<<2+4<<" "<<10-2-4<<endl;
    }
    else if (T == 3)
    {
        int e=14/4;

        cout<<e<<endl;
        cout<<e*4<<endl;
        cout<<14-e*4<<endl;
    } 
    else if (T == 4)
    {
        cout<<500.0/3<<endl;
    } 
    else if (T == 5) 
    {
        cout<<(260+220)/(12+20)<<endl;
    }
    else if (T == 9) 
    {
        cout<<(((1+1)*2+1)*2+1)*2<<endl;
    } 
    else if (T == 6) 
    {
        double d=6,b=9;
        double c=sqrt(d*d+b*b);//勾股定理请背熟:对角线=√(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 i=3.141593;

        cout<<2*i*r<<endl;
        cout<<r*r*i<<endl;
        cout<<4.0/3*i*r*r*r<<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) 
    {
        cout << 16 << endl;
    } 
    else if (T == 14)
    {
        cout<<50<<endl;
    }
    return 0;
}

by taikongsa @ 2024-08-17 23:56:02

@are_you_sure 谢谢,已关注


by are_you_sure @ 2024-08-18 00:05:41

@taikongsa 送给你的东西


|