結果

問題 No.143 豆
ユーザー yagi2yagi2
提出日時 2017-04-24 18:12:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 468 bytes
コンパイル時間 3,042 ms
コンパイル使用メモリ 72,752 KB
実行使用メモリ 56,312 KB
最終ジャッジ日時 2023-09-30 17:01:38
合計ジャッジ時間 6,152 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
53,820 KB
testcase_01 AC 124 ms
55,632 KB
testcase_02 AC 122 ms
55,724 KB
testcase_03 AC 125 ms
56,036 KB
testcase_04 AC 126 ms
53,492 KB
testcase_05 AC 125 ms
55,400 KB
testcase_06 AC 126 ms
55,424 KB
testcase_07 AC 125 ms
55,728 KB
testcase_08 AC 125 ms
55,420 KB
testcase_09 AC 125 ms
56,312 KB
testcase_10 AC 125 ms
55,444 KB
testcase_11 AC 123 ms
56,040 KB
testcase_12 AC 125 ms
55,412 KB
testcase_13 AC 124 ms
55,408 KB
testcase_14 AC 123 ms
55,916 KB
testcase_15 AC 125 ms
55,804 KB
testcase_16 AC 119 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int K = Integer.parseInt(sc.next());
        int N = Integer.parseInt(sc.next());
        int F = Integer.parseInt(sc.next());

        long sum = 0;
        for (int i = 0; i < F; i++) {
            sum += Long.parseLong(sc.next());
        }

        System.out.println((sum > (K * N))? "-1" : ((K * N) - sum));
    }
}
0