結果

問題 No.2052 Indegree
ユーザー ks2mks2m
提出日時 2022-08-21 12:50:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 2,083 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 41,952 KB
最終ジャッジ日時 2024-04-18 12:39:17
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,056 KB
testcase_01 AC 122 ms
41,600 KB
testcase_02 AC 122 ms
41,244 KB
testcase_03 AC 131 ms
41,604 KB
testcase_04 AC 132 ms
41,584 KB
testcase_05 AC 130 ms
41,396 KB
testcase_06 AC 116 ms
41,620 KB
testcase_07 AC 108 ms
41,528 KB
testcase_08 AC 131 ms
41,952 KB
testcase_09 AC 135 ms
41,664 KB
testcase_10 AC 127 ms
41,332 KB
testcase_11 AC 137 ms
41,916 KB
testcase_12 AC 121 ms
41,572 KB
testcase_13 AC 125 ms
41,216 KB
testcase_14 AC 107 ms
41,368 KB
testcase_15 AC 120 ms
41,148 KB
testcase_16 AC 129 ms
41,556 KB
testcase_17 AC 125 ms
41,740 KB
testcase_18 AC 128 ms
41,272 KB
testcase_19 AC 141 ms
41,472 KB
testcase_20 AC 129 ms
41,700 KB
testcase_21 AC 134 ms
41,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] c = new int[n];
		for (int i = 0; i < m; i++) {
			sc.nextInt();
			int b = sc.nextInt() - 1;
			c[b]++;
		}
		sc.close();

		int ans = 0;
		for (int i = 0; i < c.length; i++) {
			if (c[i] == 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}
0