結果

問題 No.143 豆
ユーザー len_proglen_prog
提出日時 2016-06-07 12:02:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 403 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 72,576 KB
実行使用メモリ 57,696 KB
最終ジャッジ日時 2023-09-30 16:46:30
合計ジャッジ時間 5,416 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,616 KB
testcase_01 AC 138 ms
55,936 KB
testcase_02 AC 131 ms
57,696 KB
testcase_03 AC 134 ms
55,772 KB
testcase_04 AC 135 ms
55,508 KB
testcase_05 AC 132 ms
55,460 KB
testcase_06 AC 135 ms
55,880 KB
testcase_07 AC 136 ms
55,888 KB
testcase_08 AC 136 ms
55,848 KB
testcase_09 AC 135 ms
55,676 KB
testcase_10 AC 135 ms
55,492 KB
testcase_11 AC 133 ms
55,936 KB
testcase_12 AC 138 ms
55,760 KB
testcase_13 AC 136 ms
55,900 KB
testcase_14 AC 137 ms
55,700 KB
testcase_15 AC 139 ms
55,448 KB
testcase_16 AC 127 ms
55,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int K,N,F;
		K = scan.nextInt();
		N = scan.nextInt();
		F = scan.nextInt();

		int total = K * N;

		for(int i = 0; i < F; i++){
			total -= scan.nextInt();
		}

		if(total < 0){
			System.out.println(-1);
		}else{
			System.out.println(total);
		}
		scan.close();
	}
}
0