結果

問題 No.143 豆
ユーザー lotokalotoka
提出日時 2021-06-04 22:10:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 151 ms / 1,000 ms
コード長 631 bytes
コンパイル時間 2,308 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 41,696 KB
最終ジャッジ日時 2024-04-30 03:07:23
合計ジャッジ時間 5,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,200 KB
testcase_01 AC 141 ms
41,696 KB
testcase_02 AC 141 ms
41,664 KB
testcase_03 AC 151 ms
41,396 KB
testcase_04 AC 143 ms
41,304 KB
testcase_05 AC 141 ms
41,372 KB
testcase_06 AC 143 ms
41,424 KB
testcase_07 AC 141 ms
41,448 KB
testcase_08 AC 142 ms
41,124 KB
testcase_09 AC 142 ms
41,616 KB
testcase_10 AC 141 ms
41,444 KB
testcase_11 AC 137 ms
41,196 KB
testcase_12 AC 139 ms
41,008 KB
testcase_13 AC 140 ms
41,232 KB
testcase_14 AC 143 ms
41,632 KB
testcase_15 AC 143 ms
41,284 KB
testcase_16 AC 134 ms
41,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int K = scanner.nextInt();
        int N = scanner.nextInt();
        int F = scanner.nextInt();
        int sig = K * N;
        
        int[] A = new int[F];
        
        for (int i = 0; i < F; i++){
            A[i] = scanner.nextInt();
        }
        
        for (int i = 0; i < F; i++){
            sig -= A[i];
        }
        
        if (sig < 0){
            System.out.println(-1);
        }
        
        else{
            System.out.println(sig);
        }
    }
}
0