P8534 题解
思路
本题考查分支结构的基本应用。
首先判断
注意事项
- 不开
long long见祖宗。
AC CODE
#include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
void solve(){
int x=read(),s=read();
int cnt=2; // 初始的 2 个残机
// 判断是否通过关卡
if(x>=3)
++cnt;
if(x>=5)
++cnt;
// 判断是否达到分数
if(s>=10000000)
++cnt;
if(s>=20000000)
++cnt;
if(s>=40000000)
++cnt;
if(s>=60000000)
++cnt;
printf("%lld\n",cnt);
return;
}
signed main(){
int T=read();
while(T--)
solve();
return 0;
}