結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-08-06 09:18:33 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 237 bytes |
| 記録 | |
| コンパイル時間 | 174 ms |
| コンパイル使用メモリ | 29,384 KB |
| 最終ジャッジ日時 | 2026-02-23 22:12:38 |
|
ジャッジサーバー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]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#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;
}
くれちー