結果

問題 No.143 豆
ユーザー HaleakalaHaleakala
提出日時 2018-02-18 22:25:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 551 bytes
コンパイル時間 3,810 ms
コンパイル使用メモリ 72,748 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2023-09-30 17:12:32
合計ジャッジ時間 6,547 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,860 KB
testcase_01 AC 133 ms
55,632 KB
testcase_02 AC 127 ms
55,608 KB
testcase_03 AC 128 ms
55,424 KB
testcase_04 AC 128 ms
56,148 KB
testcase_05 AC 128 ms
55,440 KB
testcase_06 AC 129 ms
55,652 KB
testcase_07 AC 128 ms
53,672 KB
testcase_08 AC 129 ms
55,640 KB
testcase_09 AC 130 ms
55,912 KB
testcase_10 AC 128 ms
55,648 KB
testcase_11 AC 128 ms
55,620 KB
testcase_12 AC 129 ms
55,632 KB
testcase_13 AC 129 ms
55,616 KB
testcase_14 AC 129 ms
55,892 KB
testcase_15 AC 129 ms
51,624 KB
testcase_16 AC 122 ms
55,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Answer {
	public static void main(String str[]) {
        Scanner sc = new Scanner(System.in);

        int beanNum = Integer.valueOf(sc.next());
        int hukuroNum = Integer.valueOf(sc.next());
        int familyNum = Integer.valueOf(sc.next());

        int rest = beanNum * hukuroNum;
        for(int i=0; i<familyNum; i++) {
        	rest -= Integer.valueOf(sc.next());
        }
        if(rest < 0) {
        	System.out.println("-1");
        } else {
        	System.out.println(rest);
        }
	}
}
0