結果

問題 No.143 豆
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-11 21:42:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 3,220 ms
コンパイル使用メモリ 72,168 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-09-10 12:43:57
合計ジャッジ時間 6,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,840 KB
testcase_01 AC 130 ms
56,292 KB
testcase_02 AC 126 ms
55,564 KB
testcase_03 AC 130 ms
55,732 KB
testcase_04 AC 130 ms
55,700 KB
testcase_05 AC 130 ms
56,152 KB
testcase_06 AC 130 ms
55,852 KB
testcase_07 AC 129 ms
55,608 KB
testcase_08 AC 129 ms
55,672 KB
testcase_09 WA -
testcase_10 AC 130 ms
55,732 KB
testcase_11 AC 126 ms
55,772 KB
testcase_12 AC 127 ms
55,712 KB
testcase_13 AC 130 ms
55,704 KB
testcase_14 AC 129 ms
55,684 KB
testcase_15 AC 131 ms
55,680 KB
testcase_16 AC 121 ms
55,608 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