0_0_12918221_23183\Main.java:2: ÀàÖظ´£º Main
class Main { StringBuffer s = new StringBuffer(); public void ss(String s) { this.s = this.s.append(s); } public int ansS() { char a, b; a = s.charAt(0); b = s.charAt(2); if (a == b) return 0; else if ((a == 'R' && b == 'S') || (a == 'S' && b == 'P') || (a == 'P' && b == 'R')) return 1; else return -1; } } public class Main { public static void main(String[] args) { Scanner inScanner = new Scanner(System.in); int T; T = inScanner.nextInt(); for (int k = 0; k < T; k++) { int n = inScanner.nextInt(); inScanner.nextLine(); int cntA = 0, cntB = 0; for (int i = 0; i < n; i++) { A aA = new A(); aA.ss(inScanner.nextLine()); if (aA.ansS() == 1) cntA++; else if (aA.ansS() == -1) cntB++; } if (cntA == cntB) System.out.println("TIE"); else if (cntA > cntB) System.out.println("Player 1"); else System.out.println("Player 2"); } } }
|