結果

問題 No.143 豆
ユーザー ffmm00ffmm00
提出日時 2015-06-10 03:00:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 374 bytes
コンパイル時間 3,047 ms
コンパイル使用メモリ 72,036 KB
実行使用メモリ 56,332 KB
最終ジャッジ日時 2023-09-30 16:35:19
合計ジャッジ時間 6,088 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
53,688 KB
testcase_01 AC 128 ms
56,044 KB
testcase_02 AC 125 ms
55,656 KB
testcase_03 AC 128 ms
56,104 KB
testcase_04 AC 128 ms
55,896 KB
testcase_05 AC 121 ms
55,560 KB
testcase_06 AC 125 ms
56,252 KB
testcase_07 AC 123 ms
55,788 KB
testcase_08 AC 129 ms
55,604 KB
testcase_09 AC 130 ms
56,332 KB
testcase_10 AC 129 ms
55,876 KB
testcase_11 AC 128 ms
55,464 KB
testcase_12 AC 129 ms
56,076 KB
testcase_13 AC 130 ms
55,936 KB
testcase_14 AC 131 ms
55,740 KB
testcase_15 AC 132 ms
55,664 KB
testcase_16 AC 121 ms
55,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N143 {

	public static void main(String[] args) {

		Scanner sca = new Scanner(System.in);
		int k = sca.nextInt();
		int n = sca.nextInt();
		int f = sca.nextInt();

		k = k * n;

		for (int i = 0; i < f; i++) {
			k -= sca.nextInt();
			if (k < 0) {
				System.out.println("-1");
				return;
			}
		}

		System.out.println(k);

	}
}
0