标签:ble family c++ 超过 限制 its view clu 计算
| 猜拳游戏 |
| 难度级别:A; 运行时间限制:1000ms; 运行空间限制:51200KB; 代码长度限制:2000000B |
|
试题描述
|
|
甲和乙玩猜拳游戏,计算出谁赢。先输入甲出的拳,再输入乙出的拳。假定剪刀为 2,石头为 0,布为 5。如果输入为非0,2,5的数字,则输出“输入有误”。请编程输出二人出拳比对的结果。如果平局则输出“平局”,如果甲赢,输出“甲WIN!”,如果乙赢则输出“乙WIN!”。(叹号为英文模式) |
|
输入
|
|
一行,包括两个不超过 1000 的自然数,分别表示甲乙出拳的代号。
|
|
输出
|
|
按题目要求输出结果。
|
|
输入示例
|
|
2 5
|
|
输出示例
|
|
甲WIN!
|
石头剪刀布~考虑到所有情况就行。
代码:
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
scanf("%d%d",&a,&b);
if(a==b) printf("平局");
else if(a==5&&b==0) printf("甲WIN!");
else if(a==2&&b==5) printf("甲WIN!");
else if(a==0&&b==2) printf("甲WIN!");
else if(a==0&&b==5) printf("乙WIN!");
else if(a==2&&b==0) printf("乙WIN!");
else if(a==5&&b==2) printf("乙WIN!");
else printf("输入有误");
return 0;
}
标签:ble family c++ 超过 限制 its view clu 计算
原文地址:https://www.cnblogs.com/DARTH-VADER-EMPIRE/p/9501884.html