C++65分求救!!!

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

yinbe @ 2022-08-24 09:07:22

#include<bits/stdc++.h>
using namespace std;
int main() 
{
    int a;
    scanf("%d",&a);
    if (a == 1) 
    {
        printf("I love luogu");
    } else if (a==2) 
    {
        printf("%d %d",2+4,10-2-4);
    } else if (a==3) 
    {
        printf("%d %d %d",14/4,14/4*4,14%4);
    } else if (a==4) 
    {
        printf("%.3lf",500/3);
    } else if (a==5)
    {
        printf("%d",(220+260)/(12+20));
    } else if (a==6) 
    {
        cout<<sqrt(6*6+9*9);
    } else if (a==7) 
    {
        cout<<100+10<<endl<<100+10-20<<endl<<0;
    } else if (a==8) 
    {
        cout<<2*5*3.141593<<endl<<5*5*3.141593<<endl<<5*5*5*3.141593*4/3<<endl;
    } else if (a==9) 
    {
        printf("%d",(((1+1)*2+1)*2+1)*2);
    } else if (a==10) 
    {
        printf("%d",9);
    } else if (a==11) 
    {
        cout<<100*1.0/(8-5);
    } else if (a==12) 
    {
        cout<<"13"<<endl<<"r"<<endl;
    } else if (a==13) 
    {
        cout<<cbrt(4*4*4*4/3*3.141593+10*10*10*4/3*3.141593);
    } else if (a==14) 
    {
        printf("%d",50);
    }
    return 0;
}

by mmh08100566 @ 2022-08-24 09:11:34

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    switch(t)
    {
        case 1:{
            printf("I love Luogu!");
            break;
        }
            case 2:{
            printf("%d %d",2+4,10-(2+4));
            break;
        }
            case 3:{
            printf("%d\n%d\n%d",14/4,14-14%4,14%4);
            break;
        }
            case 4:{
            double answer=500.0/3;
            printf("%.3f",answer);
            break;
        }
            case 5:{
            printf("%d",(220+260)/(20+12)); 
            break;
        }
            case 6:{
            cout<<sqrt(pow(6,2)+pow(9,2));
            break;
        }
            case 7:{
            printf("%d\n%d\n%d",100+10,100+10-20,0);
            break;
        }
            case 8:{
            const double pi=3.141593;
            cout<<2*5*pi<<'\n'<<pow(5,2)*pi<<'\n'<<4/3.0*pow(5,3)*pi;
            break;
        }
            case 9:{
            printf("%d",22);
            break;
        }
            case 10:{
            cout<<9;
            break;
        }
            case 11:{
            cout<<100.0/3;
            break;
        }
            case 12:{
            cout<<13<<'\n'<<"R";
            break;
        }
            case 13:{
            const double pi=3.141593;
            //double answer=pow(4/3.0*pow(4,3)*pi+4/3.0*pow(10,3)*pi,1.0/3);
            //int answer1=answer;
            printf("%d",16);
            break;
        }
            case 14:{
            cout<<50; 
            break;
        }
    }
    return 0;
 } 

by Endline @ 2022-08-24 09:29:30

"I Love Luogu"


by yinbe @ 2022-08-27 20:22:14

I love luogu 有问题吗


by Lisia @ 2022-09-10 13:21:18

少了!号


by siyu0816 @ 2022-10-05 12:07:13

追求更简单

#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    cin>>n;
    switch(n){
        case 1:{
            cout<<"I love Luogu!"<<endl;
            break;
        }
        case 2:{
            cout<<2+4<<" "<<10-2-4<<endl;
            break;
        }
        case 3:{
            int a=14/4;
            cout<<a<<endl;
            cout<<a*4<<endl;
            cout<<14-a*4<<endl;
            break;
        }
        case 4:{
            cout<<500.0/3<<endl;
            break;
        }
        case 5:{
            cout<<(260+220)/(12+20)<<endl;
            break;
        }
        case 6:{
            double a=6,b=9;
            double c=sqrt(a*a+b*b);
            cout<<c<<endl;
            break;
        }
        case 7:{
            int a=100;
            a+=10;
            cout<<a<<endl;
            a-=20;
            cout<<a<<endl;
            a=0;
            cout<<a<<endl;
            break;
        }
        case 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;
            break;
        }
        case 9:{
            cout<<(((1+1)*2+1)*2+1)*2<<endl;
            break;
        }
        case 10:{
            cout<<9<<endl;
            break;
        }
        case 11:{
            cout<<100.0/(8-5)<<endl;
            break;
        }
        case 12:{
            cout<<'M'-'A'+1<<endl;
            cout<<char('A'-1+18)<<endl;
            break;
        }
        case 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);
            break;
        }
        case 14:{
            cout<<50<<endl;
            break;
        }
    }
    return 0;
}

by yinbe @ 2023-01-01 17:12:27

历时五个月,终于在2023-1-1晚上17:10过了这题了!!!


|