結果

問題 No.143 豆
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-18 16:41:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 361 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 72,552 KB
実行使用メモリ 56,092 KB
最終ジャッジ日時 2023-09-30 17:03:02
合計ジャッジ時間 5,249 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,712 KB
testcase_01 AC 133 ms
55,812 KB
testcase_02 AC 131 ms
55,672 KB
testcase_03 AC 133 ms
55,700 KB
testcase_04 AC 133 ms
55,676 KB
testcase_05 AC 134 ms
55,812 KB
testcase_06 AC 133 ms
55,728 KB
testcase_07 AC 136 ms
55,616 KB
testcase_08 AC 141 ms
55,596 KB
testcase_09 AC 143 ms
55,824 KB
testcase_10 AC 133 ms
55,824 KB
testcase_11 AC 131 ms
53,780 KB
testcase_12 AC 133 ms
55,744 KB
testcase_13 AC 135 ms
55,604 KB
testcase_14 AC 137 ms
56,092 KB
testcase_15 AC 136 ms
55,920 KB
testcase_16 AC 125 ms
55,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  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 sum = 0;
    for(int i = 0; i < F; i++) {
      sum += sc.nextInt();
    }
    int ans = Math.max(-1, K * N - sum);
    System.out.println(ans);
  }
}
0