AcWing 763. 循环相克令 - Java
原题链接
简单
作者:
KYCygni
,
2021-03-17 01:50:14
,
所有人可见
,
阅读 278
Java 代码
import java.util.Scanner;
public class Main
{
public static int getRank(String s)
{
if (s.compareTo("Hunter") == 0)
return 0;
if (s.compareTo("Bear") == 0)
return 1;
if (s.compareTo("Gun") == 0)
return 2;
return -1;
}
public static void main (String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
for (int i = 0; i < n; i ++)
{
int r1 = getRank(cin.next());
int r2 = getRank(cin.next());
if (r1 == r2)
System.out.println("Tie");
else if ((r1 + 1 ) % 3 == r2)
System.out.println("Player2");
else
System.out.println("Player1");
}
}
}