結果

問題 No.143 豆
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 22:39:53
言語 Java19
(openjdk 21)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 548 bytes
コンパイル時間 2,411 ms
コンパイル使用メモリ 71,616 KB
実行使用メモリ 55,988 KB
最終ジャッジ日時 2023-09-30 16:32:37
合計ジャッジ時間 5,319 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,692 KB
testcase_01 AC 139 ms
55,640 KB
testcase_02 AC 136 ms
55,440 KB
testcase_03 AC 136 ms
55,840 KB
testcase_04 AC 138 ms
55,932 KB
testcase_05 AC 138 ms
55,524 KB
testcase_06 AC 137 ms
55,724 KB
testcase_07 AC 139 ms
55,796 KB
testcase_08 AC 144 ms
55,832 KB
testcase_09 AC 137 ms
55,700 KB
testcase_10 AC 135 ms
55,648 KB
testcase_11 AC 135 ms
55,716 KB
testcase_12 AC 139 ms
55,712 KB
testcase_13 AC 141 ms
55,908 KB
testcase_14 AC 138 ms
55,988 KB
testcase_15 AC 141 ms
55,492 KB
testcase_16 AC 133 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
       int k = koko.nextInt();
       int n = koko.nextInt();
       int f = koko.nextInt();
       int[] a = new int[f];
       int rest;
       int all = 0;
       for(int i = 0; i<f; i++){
           a[i] = koko.nextInt();
           all = all + a[i];
       }
       if(k*n>=all){
           rest = k*n-all;
       }else{
           rest = -1;
       }
       System.out.println(rest);
    }
}
0