結果

問題 No.143 豆
ユーザー ryosuke0825ryosuke0825
提出日時 2018-04-07 21:27:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 1,000 ms
コード長 416 bytes
コンパイル時間 4,002 ms
コンパイル使用メモリ 72,528 KB
実行使用メモリ 56,560 KB
最終ジャッジ日時 2023-09-30 17:15:15
合計ジャッジ時間 7,187 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,676 KB
testcase_01 AC 128 ms
55,436 KB
testcase_02 AC 126 ms
55,416 KB
testcase_03 AC 127 ms
56,244 KB
testcase_04 AC 131 ms
56,224 KB
testcase_05 AC 131 ms
55,764 KB
testcase_06 AC 132 ms
55,696 KB
testcase_07 AC 131 ms
55,708 KB
testcase_08 AC 129 ms
55,680 KB
testcase_09 AC 132 ms
55,912 KB
testcase_10 AC 131 ms
55,684 KB
testcase_11 AC 147 ms
55,656 KB
testcase_12 AC 128 ms
56,560 KB
testcase_13 AC 131 ms
56,020 KB
testcase_14 AC 132 ms
55,416 KB
testcase_15 AC 133 ms
55,420 KB
testcase_16 AC 121 ms
55,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143 {

	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 ageSum = 0;
		for (int i = 1; i <= F; i++) {
			int age = sc.nextInt();
			ageSum += age;
		}

		if (K * N >= ageSum) {
			System.out.println(K * N - ageSum);
		} else {
			System.out.println(-1);
		}
	}

}
0