盘点一些弱智代码

P1001 A+B Problem

wyp20130701 @ 2024-10-14 20:41:21

正常版:

#include <iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
    return 0;
}

弱智度:40%:

#include <iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    for (int i = 1;i <= b;i++)
    {
        a++;
    }
    cout << a << endl;
    return 0;
}

弱智度 70%:

#include <iostream>
using namespace std;
int main()
{
    long long a,b;
    cin >> a >> b;
    for (int i = 1;;i++)
    {
        if (i == a + b)
        {
            cout << i;
            break;
        }
    }
    return 0;
}

弱智度 999999%:

#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    srand(time(0));
    int a,b;
    cin >> a >> b;
    int ans = rand();
    if (ans == a + b)
    {
        cout << ans << endl;
    }
    else
    {
        while (ans != a + b)
        {
            ans = rand();
        }
        cout << ans << endl;
    }
    return 0;
}

by Lucas2024 @ 2025-01-02 20:08:05

难绷

上一页 |