結果
問題 | No.26 シャッフルゲーム |
ユーザー |
![]() |
提出日時 | 2016-10-20 13:24:04 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 170 ms / 5,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 1,979 ms |
コンパイル使用メモリ | 74,672 KB |
実行使用メモリ | 41,808 KB |
最終ジャッジ日時 | 2024-11-23 14:42:00 |
合計ジャッジ時間 | 4,177 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int initialCircle =sc.nextInt(); int numChange = sc.nextInt(); int currentCircle = initialCircle; for (int i = 0; i < numChange; i++) { int from = sc.nextInt(); int to = sc.nextInt(); if (from == currentCircle) { currentCircle = to; } else if (to == currentCircle) { currentCircle = from; } } System.out.println(currentCircle); } }