結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2016-11-08 10:47:18 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 170 ms / 5,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 3,296 ms |
コンパイル使用メモリ | 74,264 KB |
実行使用メモリ | 54,476 KB |
最終ジャッジ日時 | 2024-11-25 04:37:40 |
合計ジャッジ時間 | 4,906 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import java.util.Scanner; import java.util.Arrays; public class pre { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] sort = new int[3]; Arrays.fill(sort,0); sort[n-1] = 1; int p,q,tmp; for(int i=0;i<m;i++){ p = sc.nextInt(); q = sc.nextInt(); tmp = sort[p-1]; sort[p-1] = sort[q-1]; sort[q-1] = tmp; } for(int i=0;i<3;i++){ if(sort[i] == 1) System.out.println(i+1); } } }