結果

問題 No.143 豆
ユーザー GrenacheGrenache
提出日時 2015-06-30 20:11:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 1,000 ms
コード長 511 bytes
コンパイル時間 3,489 ms
コンパイル使用メモリ 71,808 KB
実行使用メモリ 56,048 KB
最終ジャッジ日時 2023-09-30 16:36:02
合計ジャッジ時間 6,535 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,872 KB
testcase_01 AC 138 ms
55,700 KB
testcase_02 AC 134 ms
55,756 KB
testcase_03 AC 135 ms
55,496 KB
testcase_04 AC 136 ms
55,996 KB
testcase_05 AC 140 ms
55,708 KB
testcase_06 AC 136 ms
55,700 KB
testcase_07 AC 135 ms
55,928 KB
testcase_08 AC 135 ms
56,048 KB
testcase_09 AC 136 ms
55,648 KB
testcase_10 AC 134 ms
55,704 KB
testcase_11 AC 132 ms
55,432 KB
testcase_12 AC 136 ms
56,000 KB
testcase_13 AC 138 ms
55,684 KB
testcase_14 AC 138 ms
55,720 KB
testcase_15 AC 138 ms
55,440 KB
testcase_16 AC 126 ms
55,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder143 {

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

        int k = sc.nextInt();
        int n = sc.nextInt();
        int f = sc.nextInt();
        
        int sum = k * n;
        for (int i = 0; i < f; i++) {
        	sum -= sc.nextInt();
        }

        if (sum >= 0) {
        	System.out.println(sum);
        } else {
        	System.out.println(-1);
        }
        
        sc.close();
    }
}
0