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. 1.7-06编程基础之字符串 字符翻转

    1.7编程基础之字符串 06:合法 C 标识符 总时间限制: 1000ms 内存限制: 65536kB 描述 给定一个不包含空白符的字符串,请判断是否是C语言合法的标识符号(注:题目保证这些字符串一定 ...

  2. 1.7 编程基础之字符串 34 回文子串 python

    http://noi.openjudge.cn/ch0107/34/ """1.7 编程基础之字符串 34 回文子串 http://noi.openjudge.cn/ch ...

  3. 1.7 编程基础之字符串 30 字符环 python

    http://noi.openjudge.cn/ch0107/30/ """ 1.7 编程基础之字符串 30 字符环 http://noi.openjudge.cn/ch ...

  4. 1.7 编程基础之字符串 31 字符串p型编码 python

    http://noi.openjudge.cn/ch0107/31/ """ 1.7 编程基础之字符串 31 字符串p型编码 http://noi.openjudge.c ...

  5. 1.7 编程基础之字符串 32 行程长度编码 python

    http://noi.openjudge.cn/ch0107/32/ """ 1.7 编程基础之字符串 32 行程长度编码 http://noi.openjudge.cn ...

  6. 1.7 编程基础之字符串 33 判断字符串是否为回文 python

    http:// http://noi.openjudge.cn/ch0107/33/ """1.7 编程基础之字符串 33 判断字符串是否为回文http://noi.op ...

  7. 1.7 编程基础之字符串 27 单词翻转 4分 python

    """ 1.7 编程基础之字符串 27 单词翻转 4分 http://noi.openjudge.cn/ch0107/24/ https://blog.csdn.net/ ...

  8. 1.7 编程基础之字符串 25 最长最短单词 python

    """ 1.7 编程基础之字符串 25 最长最短单词 http://noi.openjudge.cn/ch0107/25/ https://blog.csdn.net/h ...

  9. 1.7 编程基础之字符串 16 忽略大小写的字符串比较 python

    http://noi.openjudge.cn/ch0107/16/ """1.7 编程基础之字符串 16 忽略大小写的字符串比较 http://noi.openjudg ...

最新文章

  1. 陆奇要离职?先看看百度财报吧
  2. UVA-10714 Ants---蚂蚁模拟
  3. Linux查看ice版本,Linux下ICE的安装
  4. jQuery操作Select2控件
  5. boost::fusion::fused用法的测试程序
  6. android实现箭头流程列表_Android开发关于ExpandableListView上下箭头左右显示的笔记...
  7. java vector_Java Vector sureCapacity()方法与示例
  8. C++类的前向声明的学习
  9. SAP License:BWBCS学习笔记
  10. Spring AOP代理时 ClassCastException: $Proxy0 cannot be cast to (类型转换错误)
  11. UVa 12169 - Disgruntled Judge(拓展欧几里德)
  12. mongoDB's Optimization example
  13. 用于制作app store的截图的工具:Brief Wrapper —— 最便捷的应用商店屏幕快照
  14. 11g表名大小写 oracle_Oracle数据库总结
  15. 全面解析云智慧数据中心统一运管解决方案
  16. 华为路由器配置Telnet登录
  17. linux查看nginx昅 电视,PHP实现查询汉字笔画、笔画排序、笔画统计
  18. while在Java用法_Java中while循环用法
  19. 公共场合的wifi 靠不住
  20. Duplicate Symbols for Architecture解决办法

热门文章

  1. 进程间通信之3----信号量
  2. SQL server常用查询
  3. 分布式系统的面试题1
  4. Python--发送邮件
  5. [安卓] 19、一个蓝牙4.0安卓DEMO
  6. CSS3学习基本记录
  7. 为什么要重写toString()方法和hashcode()方法
  8. C# Json 序列化与反序列化一
  9. DEV全选多选小技巧
  10. 自定义控件 一 创建最简单的控件