結果

問題 No.26 シャッフルゲーム
ユーザー shinwisteria
提出日時 2018-03-04 16:46:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 3,630 ms
コンパイル使用メモリ 74,376 KB
実行使用メモリ 54,332 KB
最終ジャッジ日時 2024-07-08 01:49:07
合計ジャッジ時間 5,966 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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