結果

問題 No.143 豆
ユーザー rantrant
提出日時 2018-11-19 15:53:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 546 bytes
コンパイル時間 3,007 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 56,128 KB
最終ジャッジ日時 2023-09-30 17:23:42
合計ジャッジ時間 6,235 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,808 KB
testcase_01 AC 132 ms
56,128 KB
testcase_02 AC 130 ms
55,736 KB
testcase_03 AC 132 ms
55,556 KB
testcase_04 AC 135 ms
55,764 KB
testcase_05 AC 134 ms
55,832 KB
testcase_06 AC 134 ms
55,800 KB
testcase_07 AC 136 ms
55,752 KB
testcase_08 AC 135 ms
55,736 KB
testcase_09 AC 133 ms
55,416 KB
testcase_10 AC 133 ms
55,800 KB
testcase_11 AC 130 ms
55,776 KB
testcase_12 AC 133 ms
55,776 KB
testcase_13 AC 133 ms
55,712 KB
testcase_14 AC 133 ms
55,912 KB
testcase_15 AC 134 ms
55,840 KB
testcase_16 AC 125 ms
55,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ!!

        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
        int n = K*N;
        int F = sc.nextInt();
        int a = 0;
        for(int i = 0;i < F;i++){
            n-=sc.nextInt();
        }
        if(n<0){
            System.out.println("-1");
        }else{
            System.out.println(n);
        }
        
    }
}
0