题解 AT3855 【[AGC020A] Move and Win】

时间:2020-08-02 22:06:35   收藏:0   阅读:126

AT3855 【[AGC020A] Move and Win】

经过对此题分析,我们可以得出:
 结果与 b-a 的奇偶性有关。



代码

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b;
string s;
cin>>n>>a>>b;
s=(b-a)%2?"Borys":"Alice";
cout<<s<<endl;
return 0;
}

上面用到了三目运算符,相当于以下代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b;
cin>>n>>a>>b;
if((b-a)%2==0)
{
cout<<"Alice"<<endl;
}
else
{
cout<<"Borys"<<endl;
}
return 0;
}

完结撒花~(疯狂暗示 QwQ

原文:https://www.cnblogs.com/oiertbr/p/13423179.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!