hdu 2164
来源:互联网 发布:管家婆软件管理员密码 编辑:程序博客网 时间:2024/06/04 23:02
Rock, Paper, or Scissors?
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1293 Accepted Submission(s): 861
Problem Description
Rock, Paper, Scissors is a two player game, where each player simultaneously chooses one of the three items after counting to three. The game typically lasts a pre-determined number of rounds. The player who wins the most rounds wins the game. Given the number of rounds the players will compete, it is your job to determine which player wins after those rounds have been played.
The rules for what item wins are as follows:
?Rock always beats Scissors (Rock crushes Scissors)
?Scissors always beat Paper (Scissors cut Paper)
?Paper always beats Rock (Paper covers Rock)
The rules for what item wins are as follows:
?Rock always beats Scissors (Rock crushes Scissors)
?Scissors always beat Paper (Scissors cut Paper)
?Paper always beats Rock (Paper covers Rock)
Input
The first value in the input file will be an integer t (0 < t < 1000) representing the number of test cases in the input file. Following this, on a case by case basis, will be an integer n (0 < n < 100) specifying the number of rounds of Rock, Paper, Scissors played. Next will be n lines, each with either a capital R, P, or S, followed by a space, followed by a capital R, P, or S, followed by a newline. The first letter is Player 1抯 choice; the second letter is Player 2抯 choice.
Output
For each test case, report the name of the player (Player 1 or Player 2) that wins the game, followed by a newline. If the game ends up in a tie, print TIE.
Sample Input
32R PS R3P PR SS R1P R
Sample Output
Player 2TIEPlayer 1
Source
2007 ACM-ICPC Pacific Northwest Region
Recommend
lcy
#include<stdio.h>int main(){int t, n, s1, s2;char p1, p2;scanf("%d", &t);while(t--){scanf("%d", &n);s1 = 0;s2 = 0;while(n--){getchar();scanf("%c %c", &p1, &p2);if(p1 == 'R'){if(p2 == 'P')s2++;if(p2 == 'S')s1++;}else if(p1 == 'P'){if(p2 == 'S')s2++;if(p2 == 'R')s1++;}else if(p1 == 'S'){if(p2 == 'R')s2++;if(p2 == 'P')s1++;}}if(s1 > s2)printf("Player 1\n");else if(s1 == s2)printf("TIE\n");else printf("Player 2\n");}return 0;}
- hdu 2164
- hdu 2164
- hdu 2164 Beat
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- hdu-
- hdu
- HTML5 worker 多线程
- android 进程内存查看
- Java凭什么比PHP+MYSQL开发的B2B软件值钱
- 数据持久化保存(文件读写,归档,sql读写)
- JSEnhancements(VS2010 JS折叠插件)
- hdu 2164
- sprintf 格式化字符串的用法说明
- VC++中一些常见问题的解决方法
- dump工具
- 动态注册JNI
- android 中 Proguard 使用
- 类变量和实例变量的区别是什么?
- 支持非可变性
- JNI 方法