結果

問題 No.143 豆
ユーザー ほげ太郎ほげ太郎
提出日時 2018-02-22 16:19:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 486 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 71,224 KB
実行使用メモリ 56,400 KB
最終ジャッジ日時 2023-09-30 17:12:19
合計ジャッジ時間 5,053 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,932 KB
testcase_01 AC 128 ms
55,748 KB
testcase_02 AC 126 ms
55,768 KB
testcase_03 AC 127 ms
56,400 KB
testcase_04 AC 128 ms
55,604 KB
testcase_05 AC 128 ms
55,608 KB
testcase_06 AC 128 ms
55,700 KB
testcase_07 AC 128 ms
55,868 KB
testcase_08 AC 129 ms
55,604 KB
testcase_09 AC 132 ms
55,744 KB
testcase_10 AC 129 ms
55,764 KB
testcase_11 AC 125 ms
55,576 KB
testcase_12 AC 129 ms
56,136 KB
testcase_13 AC 132 ms
55,828 KB
testcase_14 AC 131 ms
55,824 KB
testcase_15 AC 132 ms
55,632 KB
testcase_16 AC 122 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        short k = sc.nextShort();
        short n = sc.nextShort();
        short f = sc.nextShort();

        int bean = k * n;

        for (int i = 0; i < f; i++) {
            bean -= sc.nextShort();
        }

        if (bean < 0) {
            System.out.println(-1);
        } else {
            System.out.println(bean);
        }

    }
}
0