結果

問題 No.143 豆
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 19:47:58
言語 Java19
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 349 bytes
コンパイル時間 5,178 ms
コンパイル使用メモリ 71,800 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-09-30 16:57:58
合計ジャッジ時間 6,121 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,640 KB
testcase_01 AC 128 ms
55,932 KB
testcase_02 AC 127 ms
55,728 KB
testcase_03 AC 127 ms
55,480 KB
testcase_04 AC 130 ms
55,712 KB
testcase_05 AC 128 ms
55,440 KB
testcase_06 AC 130 ms
55,832 KB
testcase_07 AC 130 ms
55,920 KB
testcase_08 AC 132 ms
55,736 KB
testcase_09 AC 130 ms
55,768 KB
testcase_10 AC 129 ms
56,180 KB
testcase_11 AC 127 ms
55,896 KB
testcase_12 AC 129 ms
55,804 KB
testcase_13 AC 131 ms
55,724 KB
testcase_14 AC 131 ms
55,772 KB
testcase_15 AC 131 ms
55,836 KB
testcase_16 AC 121 ms
56,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Mame {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int K = s.nextInt(), N = s.nextInt(), F = s.nextInt(), sum = 0;
		for(int i = 0; i < F;i++){
			sum += s.nextInt();
		}
		
		if(sum > N*K){
			System.out.println(-1);
		}else{
			System.out.println(N*K - sum);
		}
	}

}
0