結果

問題 No.143 豆
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-04 12:59:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 1,000 ms
コード長 417 bytes
コンパイル時間 1,947 ms
コンパイル使用メモリ 71,372 KB
実行使用メモリ 56,100 KB
最終ジャッジ日時 2023-09-30 16:42:06
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,752 KB
testcase_01 AC 128 ms
55,956 KB
testcase_02 AC 125 ms
55,688 KB
testcase_03 AC 127 ms
55,664 KB
testcase_04 AC 128 ms
55,672 KB
testcase_05 AC 129 ms
55,764 KB
testcase_06 AC 130 ms
55,840 KB
testcase_07 AC 131 ms
55,764 KB
testcase_08 AC 128 ms
55,680 KB
testcase_09 AC 128 ms
55,716 KB
testcase_10 AC 130 ms
56,092 KB
testcase_11 AC 125 ms
55,820 KB
testcase_12 AC 128 ms
56,088 KB
testcase_13 AC 129 ms
55,356 KB
testcase_14 AC 129 ms
55,904 KB
testcase_15 AC 130 ms
56,100 KB
testcase_16 AC 120 ms
55,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int k = in.nextInt();
		int n = in.nextInt();
		int f = in.nextInt();

		int[] a = new int[f];
		int sum = k * n;
		for(int i=0; i<f; i++) {
			a[i] = in.nextInt();
			sum -= a[i];
		}

		if(sum < 0) {
			System.out.println(-1);
		} else {
			System.out.println(sum);
		}
	}
}
0