結果

問題 No.2052 Indegree
ユーザー viral8viral8
提出日時 2022-10-01 10:46:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 71,992 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-08-25 03:14:53
合計ジャッジ時間 6,742 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,188 KB
testcase_01 AC 121 ms
55,832 KB
testcase_02 AC 123 ms
55,828 KB
testcase_03 AC 128 ms
55,632 KB
testcase_04 AC 132 ms
55,788 KB
testcase_05 AC 134 ms
55,844 KB
testcase_06 AC 133 ms
56,152 KB
testcase_07 AC 127 ms
56,352 KB
testcase_08 AC 130 ms
55,876 KB
testcase_09 AC 132 ms
56,084 KB
testcase_10 AC 129 ms
55,836 KB
testcase_11 AC 136 ms
56,108 KB
testcase_12 AC 123 ms
55,576 KB
testcase_13 AC 123 ms
56,004 KB
testcase_14 AC 125 ms
56,064 KB
testcase_15 AC 122 ms
55,808 KB
testcase_16 AC 126 ms
55,776 KB
testcase_17 AC 135 ms
55,900 KB
testcase_18 AC 139 ms
55,780 KB
testcase_19 AC 135 ms
56,036 KB
testcase_20 AC 136 ms
55,832 KB
testcase_21 AC 137 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

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