結果

問題 No.143 豆
ユーザー hippolover02
提出日時 2022-07-20 17:29:49
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 2,305 ms
コンパイル使用メモリ 78,028 KB
実行使用メモリ 41,636 KB
最終ジャッジ日時 2024-07-02 13:51:23
合計ジャッジ時間 5,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ!!
        Scanner sc = new Scanner(System.in);
        int bean = sc.nextInt();
        int pack = sc.nextInt();
        int fam = sc.nextInt();
        int cnt = 0;
        
        for(int i=0;i<fam;i++){
            cnt += sc.nextInt();
        }
        if((bean * pack - cnt) > 0){
            System.out.println(bean * pack - cnt);
        } else{
            System.out.println("-1");
        }
    }
}
0