結果

問題 No.143 豆
ユーザー 37zigen37zigen
提出日時 2016-03-31 11:21:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 140 ms / 1,000 ms
コード長 394 bytes
コンパイル時間 2,137 ms
コンパイル使用メモリ 71,192 KB
実行使用メモリ 56,060 KB
最終ジャッジ日時 2023-09-30 16:44:07
合計ジャッジ時間 5,477 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,560 KB
testcase_01 AC 139 ms
55,276 KB
testcase_02 AC 137 ms
55,568 KB
testcase_03 AC 137 ms
55,588 KB
testcase_04 AC 136 ms
55,600 KB
testcase_05 AC 136 ms
56,060 KB
testcase_06 AC 139 ms
55,600 KB
testcase_07 AC 137 ms
55,940 KB
testcase_08 AC 137 ms
55,616 KB
testcase_09 AC 139 ms
55,652 KB
testcase_10 AC 139 ms
55,684 KB
testcase_11 AC 132 ms
55,620 KB
testcase_12 AC 136 ms
55,316 KB
testcase_13 AC 140 ms
55,740 KB
testcase_14 AC 137 ms
55,932 KB
testcase_15 AC 139 ms
55,652 KB
testcase_16 AC 130 ms
55,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder143;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();//一袋K粒
		int n=sc.nextInt();//N袋
		int f=sc.nextInt();//家族人数
		int sum=0;
		for(int i=0;i<f;i++){
			sum+=sc.nextInt();
		}
		if(k*n>=sum){
			System.out.println(k*n-sum);
		}else{
			System.out.println(-1);
		}
	}
}
0