解题思路:
注意事项:
参考代码:
package arrLast; //题目 2849: 石头剪子布 import java.util.Scanner; public class t_2849 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while(n!=0) { String str1=sc.next(),str2=sc.next(); if(str1.equals(str2)) System.out.println("Tie"); //玩家一出石头 if(str1.equals("Rock")&&str2.equals("Paper")) System.out.println("Player2"); if(str1.equals("Rock")&&str2.equals("Scissors")) System.out.println("Player1"); //玩家一出布 if(str1.equals("Paper")&&str2.equals("Scissors")) System.out.println("Player2"); if(str1.equals("Paper")&&str2.equals("Rock")) System.out.println("Player1"); //玩家一出剪刀 if(str1.equals("Scissors")&&str2.equals("Paper")) System.out.println("Player1"); if(str1.equals("Scissors")&&str2.equals("Rock")) System.out.println("Player2"); n--; } } }
0.0分
0 人评分
WU-蓝桥杯算法提高VIP-勾股数 (C++代码)浏览:1607 |
【蟠桃记】 (C语言代码)浏览:666 |
1908题解浏览:640 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:683 |
图形输出 (C语言代码)浏览:946 |
C语言程序设计教程(第三版)课后习题12.5 (C语言代码)浏览:766 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:544 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:538 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:521 |
C二级辅导-温度转换 (C语言代码)浏览:550 |