結果

問題 No.143 豆
ユーザー くれちー
提出日時 2016-08-06 09:18:33
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 237 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:33:38
合計ジャッジ時間 723 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d %d %d", &k, &n, &f);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main() {
	int k, n, f, a[100], b = 0, i;

	scanf("%d %d %d", &k, &n, &f);
	for (i = 0; i < f; i++) {
		scanf("%d", &a[i]);
		b += a[i];
	}
	if (b > k*n) printf("-1\n");
	else printf("%d\n", k*n - b);

	return 0;
}
0