結果

問題 No.143 豆
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-20 14:41:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 431 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 72,092 KB
実行使用メモリ 56,004 KB
最終ジャッジ日時 2023-09-30 17:08:51
合計ジャッジ時間 5,251 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,688 KB
testcase_01 AC 139 ms
55,764 KB
testcase_02 AC 132 ms
55,864 KB
testcase_03 AC 134 ms
55,456 KB
testcase_04 AC 133 ms
55,712 KB
testcase_05 AC 133 ms
55,828 KB
testcase_06 AC 134 ms
55,476 KB
testcase_07 AC 135 ms
55,836 KB
testcase_08 AC 135 ms
55,820 KB
testcase_09 AC 134 ms
55,776 KB
testcase_10 AC 135 ms
55,772 KB
testcase_11 AC 131 ms
55,808 KB
testcase_12 AC 132 ms
55,472 KB
testcase_13 AC 135 ms
55,676 KB
testcase_14 AC 137 ms
56,004 KB
testcase_15 AC 137 ms
55,700 KB
testcase_16 AC 127 ms
55,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	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[] a = new int[f];
		int total = 0;
		for(int i = 0 ; i < f ; i++) {
			a[i] = sc.nextInt();
			total += a[i];
		}
		if(k * n >= total) {
			System.out.println(k * n - total);
		} else {
			System.out.println(-1);
		}
 	}
}

0