結果

問題 No.143 豆
ユーザー papipenpapipen
提出日時 2017-03-26 00:57:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 1,000 ms
コード長 385 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 71,712 KB
実行使用メモリ 56,476 KB
最終ジャッジ日時 2023-09-30 16:58:32
合計ジャッジ時間 5,027 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,476 KB
testcase_01 AC 127 ms
56,252 KB
testcase_02 AC 126 ms
55,732 KB
testcase_03 AC 127 ms
55,760 KB
testcase_04 AC 126 ms
55,712 KB
testcase_05 AC 127 ms
55,480 KB
testcase_06 AC 128 ms
56,084 KB
testcase_07 AC 128 ms
55,504 KB
testcase_08 AC 127 ms
55,456 KB
testcase_09 AC 130 ms
56,216 KB
testcase_10 AC 128 ms
56,060 KB
testcase_11 AC 125 ms
55,484 KB
testcase_12 AC 126 ms
55,716 KB
testcase_13 AC 131 ms
55,860 KB
testcase_14 AC 129 ms
55,780 KB
testcase_15 AC 131 ms
56,060 KB
testcase_16 AC 119 ms
56,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Mame{
  public static void main(String args[]){
    Scanner s = new Scanner(System.in);
    int mame = s.nextInt() * s.nextInt();
    int tabe = 0;
    int F = s.nextInt();
    for(int i = 0; i < F; i++){
      tabe += s.nextInt();
    }
    if(tabe > mame){
      System.out.println("-1");
    }else{
      System.out.println(mame - tabe);
    }
  }
}
0