結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2020-11-10 10:04:54 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 165 ms / 5,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 2,678 ms |
コンパイル使用メモリ | 73,848 KB |
実行使用メモリ | 42,024 KB |
最終ジャッジ日時 | 2024-07-22 17:16:57 |
合計ジャッジ時間 | 4,526 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean[] hasBall = new boolean[4]; hasBall[sc.nextInt()] = true; int m = sc.nextInt(); for (int i = 0; i < m; i++) { int left = sc.nextInt(); int right = sc.nextInt(); boolean tmp = hasBall[left]; hasBall[left] = hasBall[right]; hasBall[right] = tmp; } for (int i = 1; i < 4; i++) { if (hasBall[i]) { System.out.println(i); return; } } } }