結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2022-06-10 15:03:44 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 149 ms / 5,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 2,206 ms |
コンパイル使用メモリ | 75,056 KB |
実行使用メモリ | 41,624 KB |
最終ジャッジ日時 | 2024-09-21 05:46:34 |
合計ジャッジ時間 | 3,742 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc=new Scanner(System.in); String[] line; line=sc.nextLine().split(" "); int place=Integer.parseInt(line[0]); line=sc.nextLine().split(" "); int m=Integer.parseInt(line[0]); for(int i=0;i<m;i++){ line=sc.nextLine().split(" "); int tmp=Integer.parseInt(line[0]),tmp1=Integer.parseInt(line[1]); if(place==tmp) place=tmp1; else if(place==tmp1) place=tmp; } System.out.println(place); } }