結果

問題 No.143 豆
ユーザー n_gojon_gojo
提出日時 2020-04-10 15:38:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 1,000 ms
コード長 642 bytes
コンパイル時間 4,435 ms
コンパイル使用メモリ 73,496 KB
実行使用メモリ 55,976 KB
最終ジャッジ日時 2023-09-30 17:49:29
合計ジャッジ時間 6,967 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
55,764 KB
testcase_01 AC 137 ms
55,848 KB
testcase_02 AC 136 ms
55,672 KB
testcase_03 AC 136 ms
55,644 KB
testcase_04 AC 138 ms
55,644 KB
testcase_05 AC 138 ms
55,560 KB
testcase_06 AC 141 ms
55,752 KB
testcase_07 AC 140 ms
55,700 KB
testcase_08 AC 152 ms
55,356 KB
testcase_09 AC 143 ms
55,688 KB
testcase_10 AC 140 ms
55,976 KB
testcase_11 AC 142 ms
55,644 KB
testcase_12 AC 140 ms
55,784 KB
testcase_13 AC 141 ms
55,396 KB
testcase_14 AC 141 ms
55,756 KB
testcase_15 AC 141 ms
55,424 KB
testcase_16 AC 129 ms
55,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class No143 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int n = sc.nextInt();
        int f = sc.nextInt();
        
        int ageSum = 0;

        for (int i=1; i<=f; i++) {
            ageSum += sc.nextInt();
        }

        int ans = k*n - ageSum;
        if (ans < 0) {
            ans = -1;
        }
        System.out.println(ans);
    }
}
0