結果

問題 No.26 シャッフルゲーム
ユーザー jp_stejp_ste
提出日時 2014-11-09 16:37:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 815 bytes
コンパイル時間 2,968 ms
コンパイル使用メモリ 72,232 KB
実行使用メモリ 49,816 KB
最終ジャッジ日時 2023-08-30 02:47:27
合計ジャッジ時間 3,476 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,396 KB
testcase_01 AC 45 ms
49,396 KB
testcase_02 AC 48 ms
49,300 KB
testcase_03 AC 46 ms
49,396 KB
testcase_04 AC 46 ms
49,320 KB
testcase_05 AC 47 ms
49,296 KB
testcase_06 AC 47 ms
49,252 KB
testcase_07 AC 47 ms
49,420 KB
testcase_08 AC 48 ms
49,816 KB
testcase_09 AC 47 ms
49,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(r.readLine());
		int m = Integer.parseInt(r.readLine());
		int list[] = new int[3];
		
		list[n-1] = 1;
		for(int i=0; i<m; i++) {
			StringTokenizer st = new StringTokenizer(r.readLine());
			int from = Integer.parseInt(st.nextToken());
			int to = Integer.parseInt(st.nextToken());
			int temp = list[from-1];
			list[from-1] = list[to-1];
			list[to-1] = temp;
		}
		
		for(int i=0; i<3; i++) {
			if(list[i] == 1) {
				System.out.println(i+1);
				break;
			}
		}
	}
}
0