結果

問題 No.143 豆
ユーザー Daigo HIROOKA
提出日時 2018-05-11 21:42:35
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 3,587 ms
コンパイル使用メモリ 75,368 KB
実行使用メモリ 41,848 KB
最終ジャッジ日時 2024-06-28 04:02:41
合計ジャッジ時間 6,154 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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