結果

問題 No.143 豆
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-11 21:41:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 4,601 ms
コンパイル使用メモリ 73,076 KB
実行使用メモリ 56,308 KB
最終ジャッジ日時 2023-09-10 12:43:50
合計ジャッジ時間 7,918 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,872 KB
testcase_01 AC 132 ms
55,844 KB
testcase_02 AC 128 ms
56,140 KB
testcase_03 AC 130 ms
55,788 KB
testcase_04 AC 134 ms
55,512 KB
testcase_05 AC 134 ms
55,904 KB
testcase_06 AC 134 ms
55,916 KB
testcase_07 AC 135 ms
56,308 KB
testcase_08 AC 134 ms
55,632 KB
testcase_09 WA -
testcase_10 AC 135 ms
55,512 KB
testcase_11 AC 132 ms
55,656 KB
testcase_12 AC 133 ms
55,860 KB
testcase_13 AC 134 ms
55,504 KB
testcase_14 AC 138 ms
56,032 KB
testcase_15 AC 136 ms
55,908 KB
testcase_16 AC 126 ms
55,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

        int K = sc.nextInt();
        int N = sc.nextInt();
        int num_beans = K*N;

        int F = sc.nextInt();
        int num_eats = 0;
        for(int i = 0; i < F; i++){
            num_eats += sc.nextInt();
        }

        if(num_beans > num_eats){
            System.out.println(num_beans - num_eats);
        }else{
            System.out.println(-1);
        }
    }
}


0