結果

問題 No.143 豆
ユーザー hippolover02hippolover02
提出日時 2022-07-20 17:30:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 571 bytes
コンパイル時間 5,795 ms
コンパイル使用メモリ 70,824 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-15 09:53:56
合計ジャッジ時間 5,706 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,808 KB
testcase_01 AC 129 ms
55,864 KB
testcase_02 AC 125 ms
55,752 KB
testcase_03 AC 127 ms
55,548 KB
testcase_04 AC 132 ms
55,920 KB
testcase_05 AC 132 ms
55,768 KB
testcase_06 AC 132 ms
55,576 KB
testcase_07 AC 132 ms
55,736 KB
testcase_08 AC 131 ms
55,968 KB
testcase_09 AC 132 ms
55,944 KB
testcase_10 AC 130 ms
56,324 KB
testcase_11 AC 127 ms
55,708 KB
testcase_12 AC 127 ms
55,552 KB
testcase_13 AC 129 ms
56,048 KB
testcase_14 AC 129 ms
55,740 KB
testcase_15 AC 132 ms
55,916 KB
testcase_16 AC 121 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

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