79分,求大佬帮帮忙

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

fsc0190 @ 2023-04-05 08:26:38

#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)  
    {
        cout << 3 << endl << 12 << endl << 2;
    }  
    else if (T == 4)  
    {
        printf("%.6lf",500.0/3.0);
    }  
    else if (T == 5)  
    {
        cout << 15;
    }  
    else if (T == 6)  
    {
        cout << sqrt(117);
    }  
    else if (T == 7)  
    {
        cout << 110 << endl << 90 << 0;
    }  
    else if (T == 8)  
    {
        cout << 31.41592653 << endl << 78.539816325 << 523.5987755;
    }
    else if (T == 9)  
    {
        cout << 22;
    }  
    else if (T == 10)  
    {
        cout << 9;
    }  
    else if (T == 11)  
    {
        cout << 33.3333;
    }  
    else if (T == 12)  
    {
        cout << 13 << endl << "R";
    }  
    else if (T == 13)  
    {
        cout << 16;
    } 
    else if (T == 14)  
    {
        cout << 50;
    }
    return 0;
}

by rnf5114 @ 2023-04-05 08:56:56

@fsc0190

第四个问题可能是精度问题,我把数据下了下来直接贴上面了,第7个问题少了个endl,第8个问题精度不对,然后少了个endl

修改代码不易,给个关注呗


by rnf5114 @ 2023-04-05 08:57:07

#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)  
    {
        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(117);
    }  
    else if (T == 7)  
    {
        cout << 110 << endl << 90 <<endl<< 0;
    }  
    else if (T == 8)  
    {
        cout << 31.41593 << endl << 78.539825<<endl << 523.5988;
    }
    else if (T == 9)  
    {
        cout << 22;
    }  
    else if (T == 10)  
    {
        cout << 9;
    }  
    else if (T == 11)  
    {
        cout << 33.3333;
    }  
    else if (T == 12)  
    {
        cout << 13 << endl << "R";
    }  
    else if (T == 13)  
    {
        cout << 16;
    } 
    else if (T == 14)  
    {
        cout << 50;
    }
    return 0;
}

by newbie38 @ 2023-04-28 19:49:10

好像没准或许似乎大概可能也许恐怕

不能在讨论区发正确代码?


by fsc0190 @ 2023-05-07 16:09:43

@xchyx 好像没准或许似乎大概可能也许恐怕

也对哦


by FJ_00460 @ 2023-05-13 18:07:12

@fsc0190 尽量不用endl,你自己试试,endl比“\n”容易超时!!


by fsc0190 @ 2023-07-10 14:23:41

@water8424 已经AC了


|