結果

問題 No.24 数当てゲーム
ユーザー DaiKi117DaiKi117
提出日時 2019-09-30 14:43:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 5,876 ms
コンパイル使用メモリ 83,440 KB
実行使用メモリ 56,120 KB
最終ジャッジ日時 2024-04-14 08:03:49
合計ジャッジ時間 4,317 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    boolean[] cup = {false, false, false};
    int first = scanner.nextInt() - 1;
    int shuffle = scanner.nextInt();
    int l = 0;
    int r = 0;
    cup[first] = true;
    for(int i = 0; i < shuffle; i++){
      l = scanner.nextInt() - 1;
      r = scanner.nextInt() - 1;
      if(first == l){
        cup[first] = false;
        cup[r] = true;
        first = r;
      }else if(first == r){
        cup[first] = false;
        cup[l] = true;
        first = l;
      }
    }
    for(int i = 0; i < 3; i++){
      if(cup[i] == true){
        System.out.println(i + 1);
      }
    }
  }
}
0