fork download
  1. import java.io.*;
  2.  
  3. class stones
  4. {
  5. public static void main (String[] args) throws IOException
  6. {
  7.  
  8. int mou, sto, i, j;
  9. int p = 0, k = 0, t = 1, whi = 1;
  10. int stones[] = {5, 5, 5};
  11.  
  12. do{
  13. for(i = 0; i <= 3; j++){
  14. System.out.print(i + " :");
  15. for(j = 0; j <= stones[i]; i++)
  16. System.out.print("■");
  17. System.out.println();
  18. }
  19.  
  20. t = p % 2 + 1;
  21.  
  22. do{
  23. System.out.print("プレイヤー" + t + " 石を取る山(1~3)を選んでください");
  24. m = Integer.parseInt(br.readLine());
  25. if(m > 3 || m < 1){
  26. System.out.println("そのような山は存在しません");
  27. continue;
  28. }
  29. if(stones[m] == 0){
  30. System.out.println("その山の石は既に存在しません");
  31. continue;
  32. }
  33. k++;
  34. }while(k % 2 != 1);
  35.  
  36. do{
  37. System.out.print("プレイヤー" + t + " 取る石の数(1~3)を選んでください");
  38. s = Integer.parseInt(br.readLine());
  39. if(s > 3 || stones[m] < s){
  40. System.out.println("値が小さすぎます");
  41. continue;
  42. }
  43. if(s < 1){
  44. System.out.println("値が大きすぎます");
  45. continue;
  46. }
  47. k++;
  48. }while(k % 2 != 0);
  49.  
  50. stones[m] -= s;
  51. whi = stones[0] + stones[1] + stones[2];
  52. p++;
  53. t = p % 2 + 1;
  54.  
  55. }while(whi != 0);
  56. System.out.print("プレイヤー" + t + "の勝ちです");
  57. }
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:26: error: cannot find symbol
				m = Integer.parseInt(br.readLine());
				^
  symbol:   variable m
  location: class stones
Main.java:27: error: cannot find symbol
				if(m > 3 || m < 1){
				   ^
  symbol:   variable m
  location: class stones
Main.java:27: error: cannot find symbol
				if(m > 3 || m < 1){
				            ^
  symbol:   variable m
  location: class stones
Main.java:31: error: cannot find symbol
				if(stones[m] == 0){
				          ^
  symbol:   variable m
  location: class stones
Main.java:40: error: cannot find symbol
				s = Integer.parseInt(br.readLine());
				^
  symbol:   variable s
  location: class stones
Main.java:41: error: cannot find symbol
				if(s > 3 || stones[m] < s){
				   ^
  symbol:   variable s
  location: class stones
Main.java:41: error: cannot find symbol
				if(s > 3 || stones[m] < s){
				                   ^
  symbol:   variable m
  location: class stones
Main.java:41: error: cannot find symbol
				if(s > 3 || stones[m] < s){
				                        ^
  symbol:   variable s
  location: class stones
Main.java:45: error: cannot find symbol
				if(s < 1){
				   ^
  symbol:   variable s
  location: class stones
Main.java:52: error: cannot find symbol
			stones[m] -= s;
			       ^
  symbol:   variable m
  location: class stones
Main.java:52: error: cannot find symbol
			stones[m] -= s;
			             ^
  symbol:   variable s
  location: class stones
11 errors
stdout
Standard output is empty