結果

問題 No.143 豆
ユーザー kohaku_kohaku
提出日時 2016-11-09 20:17:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 146 ms / 1,000 ms
コード長 423 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-07-23 10:38:45
合計ジャッジ時間 5,278 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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 sum = K*N;
        int F = sc.nextInt();
        int [] A = new int [F];
int total =0;
for(int i=0; i<F; i++){
A[i]=sc.nextInt();
total = total + A[i];
}
int r = sum-total;
if(r<0){
r=-1;
}
        System.out.println(r);
    }
}
0