比赤色更红的梦

· · 题解

根据题意模拟即可。注意一开始有两个残机,以及分数 s 是可以到 10^{18} 的,因此开 long long。

从手速的角度考虑,你无需写那么多 if 语句,直接写类似于 x>=5 的布尔表达式即可,因为这个条件如果成立就会返回 true,也就是 1,否则返回 false,也就是 0

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T--)
    {
        int x;long long s;
        cin >> x >> s;
        cout << 2+(x>=3)+(x>=5)+(s>=10000000)+(s>=20000000)+(s>=40000000)+(s>=60000000) << endl;
    }
    return 0;
}