結果

問題 No.143 豆
ユーザー k_kadora
提出日時 2015-05-27 00:20:42
言語 Java
(openjdk 23)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 3,233 ms
コンパイル使用メモリ 74,784 KB
実行使用メモリ 54,200 KB
最終ジャッジ日時 2024-07-23 10:19:38
合計ジャッジ時間 6,208 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Beans {
	public static void main(String arg[]){
		int k,n,f,amount,res,temp=0;
		Scanner sc = new Scanner(System.in);
		k = sc.nextInt();
		n = sc.nextInt();
		f = sc.nextInt();
		amount = k*n;
		for(int i = 0;i<f;i++){
			temp = temp + sc.nextInt();
		}
		res = amount - temp;
		if(res < 0){
			System.out.println(-1);
		}else{
			System.out.println(res);
		}
	}
}
0