結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2019-09-30 14:50:21 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 151 ms / 5,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 2,177 ms |
コンパイル使用メモリ | 74,540 KB |
実行使用メモリ | 54,392 KB |
最終ジャッジ日時 | 2024-10-03 05:11:54 |
合計ジャッジ時間 | 3,716 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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); } } } }