Hdu2164: rock, paper, or scissors?

Source: Internet
Author: User
Tags rounds
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)
 

 

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 3
2
R p
S r
3
P
R S
S r
1
P R

 

Sample output PLAYER 2
Tie
PLAYER 1

Fake questions

I am embarrassed to make a problem-solving report.

 

# Include <stdio. h> int fun (char a, char B) {If (A = 'R' & B ='s ') | (A = 's' & B = 'P') | (A = 'P' & B = 'R') return 1; return 0;} int main () {int n, m; char a, B; scanf ("% d", & M); While (M --) {int Suma = 0, sumb = 0; scanf ("% d % * C", & N); While (n --) {scanf ("% C ", & A, & B); getchar (); Suma + = fun (a, B); sumb + = fun (B, A);} If (SUMA> sumb) printf ("Player 1 \ n"); else if (SUMA = sumb) printf ("Tie \ n"); else printf ("Player 2 \ n ");}}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.