import java.util.Random;
import java.util.Scanner;
public class N {
public static void main (String[] args) {
//1.电脑出一个拳:随机
int num1=0,num2=0;
Random rd = new Random();
for(int i=1;i<=10;i++){
// System.out.println(rd.nextInt(3));
int c= rd.nextInt(3);
System.out.println("电脑"+c);
//2.人出一个拳:输入
Scanner scan = new Scanner(System.in);
System.out.println("请出拳:0.1.2分别代表石头.剪刀.布:");
int p = scan.nextInt();
//3.比较输赢
/* switch (c) {//比较相等
case 0:
switch (p) {
case 0:
System.out.println("平局");
break;
case 1:
System.out.println("电脑赢");
break;
case 2:
System.out.println("人赢");
break;
}
break;
case 1:
switch (p) {
case 0:
System.out.println("人赢");
break;
case 1:
System.out.println("平局");
break;
case 2:
System.out.println("电脑赢");
break;
}
break;
case 2:
switch (p) {
case 0:
System.out.println("电脑赢");
break;
case 1:
System.out.println("人赢");
break;
case 2:
System.out.println("平局");
break;
}
}*/
//方法2
if(p==c) {//平局
System.out.println("平局");
}else if (c==0&&p==1||c==1&&p==2||c==2&&p==0) {//
System.out.println("电脑赢");
num1++;
}else {//
System.out.println("人赢");
num2++;
}
i++;
}
if(num1>num2){
System.out.println("最后电脑赢"+ (num2-num1)+"次");
}else if (num1>num2){
System.out.println("最后电脑赢"+ (num1-num2)+"次");
}else {
System.out.println("最后平局");
}
}
}