結果

問題 No.143 豆
ユーザー N_Gakuto7N_Gakuto7
提出日時 2020-04-02 22:45:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 71,912 KB
実行使用メモリ 55,920 KB
最終ジャッジ日時 2023-09-11 00:50:25
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,452 KB
testcase_01 AC 122 ms
55,492 KB
testcase_02 AC 120 ms
55,624 KB
testcase_03 AC 123 ms
55,524 KB
testcase_04 AC 122 ms
55,612 KB
testcase_05 AC 137 ms
55,696 KB
testcase_06 AC 122 ms
55,768 KB
testcase_07 AC 121 ms
55,692 KB
testcase_08 AC 123 ms
55,692 KB
testcase_09 WA -
testcase_10 AC 120 ms
55,920 KB
testcase_11 AC 121 ms
55,268 KB
testcase_12 AC 122 ms
55,632 KB
testcase_13 AC 124 ms
55,680 KB
testcase_14 AC 124 ms
54,408 KB
testcase_15 AC 123 ms
55,748 KB
testcase_16 AC 116 ms
55,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
         
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){

            int perBz = Integer.parseInt(sc.next());
            int bz = Integer.parseInt(sc.next());
            int fam = Integer.parseInt(sc.next());
            
            int ageSum = 0;
            for(int i = 0; i < fam; i++){
                ageSum += Integer.parseInt(sc.next());
            }

            int ans = perBz * bz - ageSum; 
            if(ans > 0) System.out.println(ans);
            else System.out.println(-1);

        }catch(Exception e){
            e.printStackTrace();
        }        
    }
}
0