fork(1) download
  1. class M{
  2. static int c(String...a){int x=(a[0].charAt(1)-a[1].charAt(1))%5/2;return x%2==x?x:x/-2;}
  3.  
  4. public static void main(String[] a){
  5. String R = "Rock",
  6. P = "Paper",
  7. S = "Scissors";
  8. System.out.println(c(R, R)); // 0
  9. System.out.println(c(R, P)); // -1
  10. System.out.println(c(R, S)); // 1
  11. System.out.println(c(P, R)); // 1
  12. System.out.println(c(P, P)); // 0
  13. System.out.println(c(P, S)); // -1
  14. System.out.println(c(S, R)); // -1
  15. System.out.println(c(S, P)); // 1
  16. System.out.println(c(S, S)); // 0
  17. }
  18. }
Success #stdin #stdout 0.03s 711168KB
stdin
Standard input is empty
stdout
0
-1
1
1
0
-1
-1
1
0