智商在线检测round。。。
A题维护
B题,先判断NO
,否则为YES
C题,判断
D题,
下面讨论
A
LL t;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
f(sb,1,t){
LL n,ans=0;
cin>>n;
f(i,1,n){
LL temp;
cin>>temp;
ans=max(ans,temp-i);
}
cout<<ans<<"\n";
}
return 0;
}
B
:
LL t,n,last,now,flag;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
f(sb,1,t){
cin>>n;
flag=(n&1)?0:1;
cin>>last;
f(i,2,n){
cin>>now;
if(last>=now)
flag=1;
last=now;
}
if(flag) cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
C
:
LL t, n, temp, a[18];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> t;
a[1] = 1;
f(i, 2, 17) a[i] = i * a[i - 1];
f(sb, 1, t)
{
cin >> n;
LL flag = 1;
f(i, 1, n)
{
cin >> temp;
LL dd = 0;
if (flag)
f(j, 2, i + 1)
{
if (temp % j)
{
dd = 1;
break;
}
}
if (dd == 0)
flag = 0;
}
if (flag)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
D
:
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
f(sb,1,t){
cin>>x>>y;
if(y<x) cout<<x+y<<"\n";
else if(x==y) cout<<x<<"\n";
else if(((x+y)>>1)%x==y%((x+y)>>1))cout<<((x+y)>>1)<<"\n";
else {
LL m=y-x;
m=m/x*x;
x+=m;
cout<<((x+y)>>1)<<"\n";
}
}
return 0;
}