結果

問題 No.143 豆
ユーザー face4face4
提出日時 2018-04-09 17:51:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 666 bytes
コンパイル時間 1,861 ms
コンパイル使用メモリ 71,620 KB
実行使用メモリ 49,492 KB
最終ジャッジ日時 2023-09-30 17:15:24
合計ジャッジ時間 3,374 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,320 KB
testcase_01 AC 42 ms
49,100 KB
testcase_02 AC 43 ms
49,264 KB
testcase_03 AC 43 ms
49,368 KB
testcase_04 AC 42 ms
49,180 KB
testcase_05 AC 41 ms
49,436 KB
testcase_06 AC 42 ms
49,092 KB
testcase_07 AC 43 ms
49,492 KB
testcase_08 AC 42 ms
49,424 KB
testcase_09 AC 42 ms
49,260 KB
testcase_10 AC 42 ms
49,104 KB
testcase_11 AC 42 ms
49,104 KB
testcase_12 AC 42 ms
49,352 KB
testcase_13 AC 43 ms
49,376 KB
testcase_14 AC 43 ms
49,212 KB
testcase_15 AC 43 ms
49,092 KB
testcase_16 AC 42 ms
49,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");

        int k = Integer.parseInt(input[0]);
        int n = Integer.parseInt(input[1]);
        int f = Integer.parseInt(input[2]);
        int res = k * n;

        String[] family = br.readLine().split(" ");
        for (int i = 0; i < f; i++) {
            res -= Integer.parseInt(family[i]);
        }

        System.out.println(Math.max(-1, res));
    }
}
0