結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
kuramu
|
| 提出日時 | 2016-01-20 11:54:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 5,000 ms |
| コード長 | 786 bytes |
| コンパイル時間 | 2,731 ms |
| コンパイル使用メモリ | 74,912 KB |
| 実行使用メモリ | 50,436 KB |
| 最終ジャッジ日時 | 2024-09-21 14:44:17 |
| 合計ジャッジ時間 | 3,104 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
try {
int ans = Integer.parseInt(stdReader.readLine());
int M = Integer.parseInt(stdReader.readLine());
for(int i=0;i<M;i++){
String temps[] = stdReader.readLine().split(" ");
if(ans == Integer.parseInt(temps[0])){
ans = Integer.parseInt(temps[1]);
}else if(ans == Integer.parseInt(temps[1])){
ans = Integer.parseInt(temps[0]);
}
}
System.out.println(ans);
} catch (IOException e) {
e.printStackTrace();
}
}
}
kuramu