結果

問題 No.2052 Indegree
ユーザー viral8
提出日時 2022-10-01 10:46:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 1,897 ms
コンパイル使用メモリ 74,364 KB
実行使用メモリ 54,328 KB
最終ジャッジ日時 2024-12-23 15:19:05
合計ジャッジ時間 5,989 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        boolean[] ind = new boolean[N+1];
        int ans = N;
        while(M-->0){
            sc.next();
            int B = sc.nextInt();
            if(!ind[B]){
                ind[B] = true;
                --ans;
            }
        }
        System.out.println(ans);
    }
}
0