結果

問題 No.143 豆
ユーザー jimanojimano
提出日時 2015-10-13 23:17:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 394 bytes
コンパイル時間 3,739 ms
コンパイル使用メモリ 71,676 KB
実行使用メモリ 56,344 KB
最終ジャッジ日時 2023-09-30 16:38:46
合計ジャッジ時間 6,084 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,856 KB
testcase_01 AC 130 ms
55,744 KB
testcase_02 AC 128 ms
55,740 KB
testcase_03 AC 127 ms
55,748 KB
testcase_04 AC 128 ms
55,760 KB
testcase_05 AC 128 ms
56,148 KB
testcase_06 AC 130 ms
55,732 KB
testcase_07 AC 129 ms
55,784 KB
testcase_08 AC 131 ms
56,084 KB
testcase_09 AC 130 ms
55,896 KB
testcase_10 AC 132 ms
55,980 KB
testcase_11 AC 129 ms
56,344 KB
testcase_12 AC 129 ms
55,456 KB
testcase_13 AC 130 ms
55,828 KB
testcase_14 AC 129 ms
55,680 KB
testcase_15 AC 130 ms
55,960 KB
testcase_16 AC 120 ms
55,840 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 beans = k * n;
		for(int j = 0; j < age.length ; j++){
			age[j] = sc.nextInt();
			beans -= age[j];
		}
		System.out.println( (beans >= 0) ? beans : -1 );
	}
}
0