結果

問題 No.143 豆
ユーザー jimanojimano
提出日時 2015-10-13 22:59:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 3,562 ms
コンパイル使用メモリ 72,808 KB
実行使用メモリ 56,128 KB
最終ジャッジ日時 2023-09-28 13:00:46
合計ジャッジ時間 6,872 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,588 KB
testcase_01 AC 137 ms
55,864 KB
testcase_02 AC 133 ms
55,816 KB
testcase_03 AC 134 ms
55,768 KB
testcase_04 AC 135 ms
55,880 KB
testcase_05 AC 134 ms
55,704 KB
testcase_06 AC 135 ms
55,812 KB
testcase_07 AC 134 ms
55,924 KB
testcase_08 AC 131 ms
55,908 KB
testcase_09 WA -
testcase_10 AC 134 ms
55,676 KB
testcase_11 AC 132 ms
55,608 KB
testcase_12 AC 132 ms
55,760 KB
testcase_13 AC 134 ms
56,128 KB
testcase_14 AC 134 ms
55,540 KB
testcase_15 AC 136 ms
56,072 KB
testcase_16 AC 125 ms
55,864 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[] age = new int[f];
		int i = 0, j = 0;

		while(sc.hasNext()){
			age[i] = sc.nextInt();
			i++;
		}

		for(int a : age) j += a;

		System.out.println( (k * n > j) ? k * n - j : -1 );
	}
}
0