結果

問題 No.143 豆
ユーザー k_kadorak_kadora
提出日時 2015-05-27 00:20:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 3,168 ms
コンパイル使用メモリ 72,000 KB
実行使用メモリ 56,104 KB
最終ジャッジ日時 2023-09-30 16:35:03
合計ジャッジ時間 6,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,740 KB
testcase_01 AC 133 ms
56,020 KB
testcase_02 AC 130 ms
55,468 KB
testcase_03 AC 131 ms
55,880 KB
testcase_04 AC 132 ms
55,524 KB
testcase_05 AC 133 ms
55,684 KB
testcase_06 AC 134 ms
55,756 KB
testcase_07 AC 138 ms
55,752 KB
testcase_08 AC 134 ms
55,884 KB
testcase_09 AC 135 ms
55,876 KB
testcase_10 AC 135 ms
55,752 KB
testcase_11 AC 131 ms
55,480 KB
testcase_12 AC 133 ms
55,768 KB
testcase_13 AC 136 ms
56,104 KB
testcase_14 AC 136 ms
55,808 KB
testcase_15 AC 137 ms
54,040 KB
testcase_16 AC 127 ms
56,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Beans {
	public static void main(String arg[]){
		int k,n,f,amount,res,temp=0;
		Scanner sc = new Scanner(System.in);
		k = sc.nextInt();
		n = sc.nextInt();
		f = sc.nextInt();
		amount = k*n;
		for(int i = 0;i<f;i++){
			temp = temp + sc.nextInt();
		}
		res = amount - temp;
		if(res < 0){
			System.out.println(-1);
		}else{
			System.out.println(res);
		}
	}
}
0