結果

問題 No.143 豆
ユーザー 8130Tsk8130Tsk
提出日時 2015-07-24 22:00:48
言語 Java19
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 395 bytes
コンパイル時間 3,274 ms
コンパイル使用メモリ 72,496 KB
実行使用メモリ 56,016 KB
最終ジャッジ日時 2023-09-30 16:37:09
合計ジャッジ時間 6,509 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,932 KB
testcase_01 AC 135 ms
55,784 KB
testcase_02 AC 133 ms
55,936 KB
testcase_03 AC 136 ms
56,016 KB
testcase_04 AC 133 ms
55,488 KB
testcase_05 AC 135 ms
55,652 KB
testcase_06 AC 133 ms
55,884 KB
testcase_07 AC 135 ms
55,852 KB
testcase_08 AC 136 ms
55,760 KB
testcase_09 AC 135 ms
55,864 KB
testcase_10 AC 134 ms
55,680 KB
testcase_11 AC 133 ms
55,728 KB
testcase_12 AC 132 ms
55,584 KB
testcase_13 AC 135 ms
55,704 KB
testcase_14 AC 139 ms
55,668 KB
testcase_15 AC 137 ms
55,712 KB
testcase_16 AC 126 ms
55,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No143 {

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

}
0