1.7编程基础之字符串_04石头剪子布
http://noi.openjudge.cn/ch0107/04/
/*
1.7编程基础之字符串_04石头剪子布
http://noi.openjudge.cn/ch0107/04/
*/
#include<iostream>
using namespace std;
int main()
{int n,i,j,k;char a[101],b[101];cin>>n;for(i=1;i<=n;i++){ cin>>a>>b; //分别输入字符串a和b if(a[0]=='R'&&b[0]=='S' ||a[0]=='S'&&b[0]=='P'||a[0]=='P'&&b[0]=='R') //只需判断第一字母 cout<<"Player1"<<endl; else if(a[0]==b[0])cout<<"Tie"<<endl;elsecout<<"Player2"<<endl;} return 0;
}
/*
NOI / 1.7编程基础之字符串 STL
04石头剪子布 2021.11.28 AC
http://noi.openjudge.cn/ch0107/solution/31685699/
*/
#include<iostream>
#include<string>
using namespace std;
int num[26]={};
int Result(string one,string two)
{if((one=="Scissors"&&two=="Paper")||(one=="Paper"&&two=="Rock")||(one=="Rock"&&two=="Scissors")){return 1;}else if(one==two){return 0;}else{return 2;}}
int main()
{int n;cin>>n;string one;string two;for(int i=0;i<n;++i){cin>>one>>two;int c=Result(one,two);if(c==1){cout<<"Player1\n";}else if(c==2){cout<<"Player2\n";}else{cout<<"Tie\n";}}return 0;
}
/*
1.7编程基础之字符串_04石头剪子布
http://noi.openjudge.cn/ch0107/04/
*/
#include<cstring>
#include<iostream>
using namespace std;int main()
{string a,b;int n;cin>>n;int i;for(i=1;i<=n;i++){cin>>a>>b;if(a==b){cout<<"Tie\n";}else {if( (a=="Rock" && b=="Scissors") || (a=="Scissors"&&b=="Paper") ||(a=="Paper"&&b=="Rock") ){cout<<"Player1\n";} else {if( (a=="Rock"&&b=="Paper") || (a=="Paper"&&b=="Scissors") ||(a=="Scissors"&&b=="Rock") ){cout<<"Player2\n";} }}}return 0;
}
1.7编程基础之字符串_04石头剪子布相关推荐
- 1.7-06编程基础之字符串 字符翻转
1.7编程基础之字符串 06:合法 C 标识符 总时间限制: 1000ms 内存限制: 65536kB 描述 给定一个不包含空白符的字符串,请判断是否是C语言合法的标识符号(注:题目保证这些字符串一定 ...
- 1.7 编程基础之字符串 34 回文子串 python
http://noi.openjudge.cn/ch0107/34/ """1.7 编程基础之字符串 34 回文子串 http://noi.openjudge.cn/ch ...
- 1.7 编程基础之字符串 30 字符环 python
http://noi.openjudge.cn/ch0107/30/ """ 1.7 编程基础之字符串 30 字符环 http://noi.openjudge.cn/ch ...
- 1.7 编程基础之字符串 31 字符串p型编码 python
http://noi.openjudge.cn/ch0107/31/ """ 1.7 编程基础之字符串 31 字符串p型编码 http://noi.openjudge.c ...
- 1.7 编程基础之字符串 32 行程长度编码 python
http://noi.openjudge.cn/ch0107/32/ """ 1.7 编程基础之字符串 32 行程长度编码 http://noi.openjudge.cn ...
- 1.7 编程基础之字符串 33 判断字符串是否为回文 python
http:// http://noi.openjudge.cn/ch0107/33/ """1.7 编程基础之字符串 33 判断字符串是否为回文http://noi.op ...
- 1.7 编程基础之字符串 27 单词翻转 4分 python
""" 1.7 编程基础之字符串 27 单词翻转 4分 http://noi.openjudge.cn/ch0107/24/ https://blog.csdn.net/ ...
- 1.7 编程基础之字符串 25 最长最短单词 python
""" 1.7 编程基础之字符串 25 最长最短单词 http://noi.openjudge.cn/ch0107/25/ https://blog.csdn.net/h ...
- 1.7 编程基础之字符串 16 忽略大小写的字符串比较 python
http://noi.openjudge.cn/ch0107/16/ """1.7 编程基础之字符串 16 忽略大小写的字符串比较 http://noi.openjudg ...
最新文章
- 陆奇要离职?先看看百度财报吧
- UVA-10714 Ants---蚂蚁模拟
- Linux查看ice版本,Linux下ICE的安装
- jQuery操作Select2控件
- boost::fusion::fused用法的测试程序
- android实现箭头流程列表_Android开发关于ExpandableListView上下箭头左右显示的笔记...
- java vector_Java Vector sureCapacity()方法与示例
- C++类的前向声明的学习
- SAP License:BWBCS学习笔记
- Spring AOP代理时 ClassCastException: $Proxy0 cannot be cast to (类型转换错误)
- UVa 12169 - Disgruntled Judge(拓展欧几里德)
- mongoDB's Optimization example
- 用于制作app store的截图的工具:Brief Wrapper —— 最便捷的应用商店屏幕快照
- 11g表名大小写 oracle_Oracle数据库总结
- 全面解析云智慧数据中心统一运管解决方案
- 华为路由器配置Telnet登录
- linux查看nginx昅 电视,PHP实现查询汉字笔画、笔画排序、笔画统计
- while在Java用法_Java中while循环用法
- 公共场合的wifi 靠不住
- Duplicate Symbols for Architecture解决办法