結果
問題 | No.2052 Indegree |
ユーザー | ks2m |
提出日時 | 2022-08-21 12:50:08 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 160 ms / 2,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 2,072 ms |
コンパイル使用メモリ | 74,704 KB |
実行使用メモリ | 41,716 KB |
最終ジャッジ日時 | 2024-10-10 05:51:39 |
合計ジャッジ時間 | 6,263 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
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); } }