結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2019-09-30 14:43:27 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 2,201 ms |
コンパイル使用メモリ | 74,800 KB |
実行使用メモリ | 54,888 KB |
最終ジャッジ日時 | 2024-10-03 05:11:49 |
合計ジャッジ時間 | 4,336 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 3 RE * 7 |
ソースコード
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);}}}}