ACM (TJU) : 3059



package volume_XXI;

import java.util.Scanner;

public class Id_3059 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in); 
		
		int testCase = input.nextInt();
		
		while ( testCase-- > 0 ) {
			
			int round = input.nextInt();
			int player1 = 0;
			int player2 = 0;
			
			for ( int i = 0; i < round; i++ ) {
				
				String first = input.next();
				String second = input.next();
				
				if ( !first.equals(second) ) {
					if ( call ( first, second ))
						player1++;
					else
						player2++;
				}
				
			}
			
			if ( player1 > player2 )
				System.out.println ("Player 1");
			else if ( player1 == player2)
				System.out.println ("TIE");
			else
				System.out.println ("Player 2");	
		}
	}
	
	static boolean call (String a, String b) {
		
		if ( a.equals("R") && b.equals("S") )
			return true;
		
		if ( a.equals("S") && b.equals("P") )
			return true;
		
		if ( a.equals("P") && b.equals("R") )
			return true;
		
		return false;
	}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s