結果

問題 No.143 豆
ユーザー face4
提出日時 2018-04-09 17:51:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 666 bytes
コンパイル時間 2,001 ms
コンパイル使用メモリ 74,180 KB
実行使用メモリ 50,404 KB
最終ジャッジ日時 2024-07-23 10:57:38
合計ジャッジ時間 3,617 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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