結果
問題 | No.26 シャッフルゲーム |
ユーザー | DaiKi117 |
提出日時 | 2019-09-30 14:50:21 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 154 ms / 5,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 2,917 ms |
コンパイル使用メモリ | 70,732 KB |
実行使用メモリ | 56,484 KB |
最終ジャッジ日時 | 2023-07-26 18:33:22 |
合計ジャッジ時間 | 4,544 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
55,660 KB |
testcase_01 | AC | 124 ms
55,960 KB |
testcase_02 | AC | 154 ms
56,288 KB |
testcase_03 | AC | 135 ms
55,904 KB |
testcase_04 | AC | 136 ms
55,848 KB |
testcase_05 | AC | 145 ms
56,040 KB |
testcase_06 | AC | 148 ms
56,328 KB |
testcase_07 | AC | 141 ms
56,484 KB |
testcase_08 | AC | 147 ms
56,004 KB |
testcase_09 | AC | 146 ms
56,008 KB |
ソースコード
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); } } } }