One Card Poker
发布时间: 2017年2月14日 14:02 最后更新: 2017年2月14日 14:09 时间限制: 1000ms 内存限制: 128M
描述
Alice和Bob在玩一个卡牌游戏,这个卡牌游戏叫做“比大小”!所有的卡牌的面值都是1~13的整数,谁的卡牌大,谁就胜利。但是卡牌的规则可能和平常的不太一样,大小规则如下:
小 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 大
换言之,1是最大的,2是最小的,和斗地主有点像哦。
现在你需要写一个程序,来判断究竟是谁取得了胜利。
Alice胜利输出Alice,Bob胜利输出Bob,平局输出Draw
输入
1≦A≦13
1≦B≦13
A and B are integers.
A is Alice,B is Bob.
The input is given from Standard Input in the following format:
A B
输出
Print Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.
样例输入1
复制
8 6
样例输出1
Alice
样例输入2
复制
1 1
样例输出2
Draw
using namespace std;
int a,b;
int main()
{
while(scanf("%d%d",&a,&b)==2){
if(a==1) a=a+13;
if(b==1) b=b+13;
if(a>b) cout<<"Alice"<<endl;
if(a==b) cout<<"Draw"<<endl;
if(a<b) cout<<"Bob"<<endl;
}
}
提交代码
Accepted! CPU time: 1ms
查看详情
本文详细解析了一款名为“比大小”的卡牌游戏算法,该游戏使用1至13的整数作为卡牌面值,其中1为最大,2为最小。文章通过一个具体的C++代码示例,展示了如何判断游戏的胜负,包括处理特殊的大小规则,即1被视为最大值的情况。此外,还提供了代码运行的时间和内存限制,以及输入输出格式。
2286

被折叠的 条评论
为什么被折叠?



