結果

問題 No.26 シャッフルゲーム
ユーザー shinwisteriashinwisteria
提出日時 2018-03-04 16:46:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 4,874 ms
コンパイル使用メモリ 72,256 KB
実行使用メモリ 56,596 KB
最終ジャッジ日時 2023-09-22 09:42:53
合計ジャッジ時間 7,151 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,592 KB
testcase_01 AC 119 ms
55,768 KB
testcase_02 AC 164 ms
56,016 KB
testcase_03 WA -
testcase_04 AC 136 ms
55,932 KB
testcase_05 WA -
testcase_06 AC 147 ms
56,596 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 161 ms
56,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con26 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] cup = new int[3];
		int N = s.nextInt() , M = s.nextInt();
		cup[N-1]++;

		for(int i = 0;i < M;i++){
			int p = s.nextInt() , q = s.nextInt();
			cup[q-1] += cup[p-1];
			cup[p-1] = 0;
		}
		s.close();

		for(int i = 0;i < 3;i++){
			if(cup[i] == 1){
				System.out.println(i+1);
			}
		}

	}

}
0