結果

問題 No.143 豆
ユーザー ken
提出日時 2018-03-13 20:25:51
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 270 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:56:02
合計ジャッジ時間 923 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main(void){
	int k, n, f, a[100], i, sum, age = 0;
	scanf("%d%d%d", &k, &n, &f);
	sum = k * n;
	for(i = 0 ; i < f ; i++){
		scanf("%d", &a[i]);
		age += a[i];
	}
	if(sum < age){
		printf("%d", -1);
	}else{
		printf("%d", sum - age);
	}
	return 0;
}
0