結果

問題 No.2052 Indegree
ユーザー viral8
提出日時 2022-10-01 10:49:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 2,362 ms
コンパイル使用メモリ 76,372 KB
実行使用メモリ 42,016 KB
最終ジャッジ日時 2024-12-23 15:21:21
合計ジャッジ時間 6,398 ms
ジャッジサーバーID
(参考情報)
judge5 / 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();
        int[] ind = new int[N];
        int ans = N;
        while(M-->0){
            sc.next();
            int B = sc.nextInt()-1;
            if(ind[B]++==0)
                --ans;
        }
        System.out.println(ans);
    }
}
0