結果

問題 No.143 豆
ユーザー springspring
提出日時 2019-06-12 14:40:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 452 bytes
コンパイル時間 3,777 ms
コンパイル使用メモリ 71,556 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-09-30 17:34:08
合計ジャッジ時間 6,538 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,884 KB
testcase_01 AC 132 ms
56,300 KB
testcase_02 AC 128 ms
55,756 KB
testcase_03 AC 131 ms
56,144 KB
testcase_04 AC 134 ms
55,916 KB
testcase_05 AC 134 ms
55,856 KB
testcase_06 AC 135 ms
55,764 KB
testcase_07 AC 135 ms
55,600 KB
testcase_08 AC 133 ms
55,956 KB
testcase_09 AC 134 ms
53,344 KB
testcase_10 AC 136 ms
55,772 KB
testcase_11 AC 131 ms
55,952 KB
testcase_12 AC 133 ms
55,600 KB
testcase_13 AC 135 ms
55,596 KB
testcase_14 AC 134 ms
55,872 KB
testcase_15 AC 136 ms
55,724 KB
testcase_16 AC 125 ms
55,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int bean = sc.nextInt();
		int pack = sc.nextInt();
		int family = sc.nextInt();
		int total = 0;
		for(int i=0;i<family;i++){
			int old = sc.nextInt();
			total += old ;
		}
		sc.close();
		if(bean*pack>=total){
			System.out.println(bean*pack-total);
		}else{
			System.out.println(-1);
		}

	}// mainmethod

} // class
0