結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2018-05-09 15:58:51 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 173 ms / 5,000 ms |
コード長 | 975 bytes |
コンパイル時間 | 3,417 ms |
コンパイル使用メモリ | 77,708 KB |
実行使用メモリ | 54,392 KB |
最終ジャッジ日時 | 2024-06-28 02:46:56 |
合計ジャッジ時間 | 5,622 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.*; public class ShuffleGame { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); try{ int Initial = scanner.nextInt(); //●の初期位置 int RepetitionNumber = scanner.nextInt(); //試行回数 for(int i = 0 ; i < RepetitionNumber ; i++){ int P = scanner.nextInt(); //Pを代入 int Q = scanner.nextInt(); //Qを代入 if(P == Initial){ Initial = Q; }else if(Q == Initial){ Initial = P; } } System.out.println(Initial); }catch(InputMismatchException e){ System.out.println("数値を入れてください。"); }catch(Exception EE){ System.out.println("想定外のエラーです。"); } } }