結果

問題 No.143 豆
ユーザー mikan765mikan765
提出日時 2017-07-05 12:40:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 372 bytes
コンパイル時間 3,367 ms
コンパイル使用メモリ 71,124 KB
実行使用メモリ 56,028 KB
最終ジャッジ日時 2023-09-30 17:04:19
合計ジャッジ時間 5,796 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,664 KB
testcase_01 AC 130 ms
55,976 KB
testcase_02 AC 128 ms
56,012 KB
testcase_03 AC 128 ms
55,888 KB
testcase_04 AC 129 ms
55,812 KB
testcase_05 AC 129 ms
56,000 KB
testcase_06 AC 130 ms
55,828 KB
testcase_07 AC 130 ms
56,028 KB
testcase_08 AC 129 ms
55,672 KB
testcase_09 AC 132 ms
55,736 KB
testcase_10 AC 131 ms
55,896 KB
testcase_11 AC 126 ms
55,928 KB
testcase_12 AC 133 ms
55,440 KB
testcase_13 AC 131 ms
55,684 KB
testcase_14 AC 131 ms
55,828 KB
testcase_15 AC 133 ms
55,760 KB
testcase_16 AC 122 ms
55,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int n = sc.nextInt();
		int mame = k*n;
		int f = sc.nextInt();
		int sum = 0;
		for(int i=0;i<f;i++){
			sum += sc.nextInt();
		}
		if(mame>=sum){
			System.out.println(mame-sum);
		}else{
			System.out.println(-1);
		}
	}
}
0