結果

問題 No.143 豆
ユーザー MatumoMatumo
提出日時 2018-07-13 20:34:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 412 bytes
コンパイル時間 2,312 ms
コンパイル使用メモリ 72,072 KB
実行使用メモリ 55,796 KB
最終ジャッジ日時 2023-09-30 17:20:32
合計ジャッジ時間 5,632 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,388 KB
testcase_01 AC 136 ms
55,788 KB
testcase_02 AC 133 ms
55,388 KB
testcase_03 AC 135 ms
55,504 KB
testcase_04 AC 136 ms
55,692 KB
testcase_05 AC 137 ms
53,700 KB
testcase_06 AC 139 ms
55,664 KB
testcase_07 AC 140 ms
55,716 KB
testcase_08 AC 137 ms
55,564 KB
testcase_09 AC 141 ms
55,496 KB
testcase_10 AC 138 ms
55,488 KB
testcase_11 AC 134 ms
55,668 KB
testcase_12 AC 132 ms
55,592 KB
testcase_13 AC 138 ms
55,588 KB
testcase_14 AC 138 ms
55,796 KB
testcase_15 AC 137 ms
55,660 KB
testcase_16 AC 125 ms
55,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int k = sc.nextInt();
		int n = sc.nextInt();
		int mame = k * n;

		int f = sc.nextInt();

		int age = 0;
		for(int i = 0; i < f; i++) {
			age += sc.nextInt();
		}

		if(age > mame) {
			System.out.println("-1");
		} else {
			System.out.println(mame - age);
		}
    }
}
0