結果

問題 No.143 豆
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-13 15:52:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 575 bytes
コンパイル時間 2,465 ms
コンパイル使用メモリ 71,652 KB
実行使用メモリ 56,368 KB
最終ジャッジ日時 2023-09-30 17:07:13
合計ジャッジ時間 5,274 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,896 KB
testcase_01 AC 134 ms
55,836 KB
testcase_02 AC 130 ms
55,832 KB
testcase_03 AC 131 ms
56,048 KB
testcase_04 AC 132 ms
55,832 KB
testcase_05 AC 133 ms
55,696 KB
testcase_06 AC 133 ms
56,368 KB
testcase_07 AC 135 ms
55,752 KB
testcase_08 AC 135 ms
56,040 KB
testcase_09 AC 135 ms
55,492 KB
testcase_10 AC 133 ms
53,820 KB
testcase_11 AC 130 ms
55,428 KB
testcase_12 AC 136 ms
55,596 KB
testcase_13 AC 138 ms
55,676 KB
testcase_14 AC 138 ms
55,904 KB
testcase_15 AC 138 ms
55,700 KB
testcase_16 AC 126 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class No143{
     public static void main(String[] args){
         Scanner sc = new Scanner(System.in);
         int k = sc.nextInt();
         int n = sc.nextInt();
         int f = sc.nextInt();
         int x[] = new int[f];
         int eatSoy = 0;
         int pickSoy = k*n;

         for(int i=0; i<f; i++){
             x[i] = sc.nextInt();
             eatSoy += x[i];
         }

         if(pickSoy<eatSoy){
             System.out.print("-1");
         }
         else{
             System.out.print(pickSoy-eatSoy);
         }
     }
}
0