結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
namaenadonaize
|
| 提出日時 | 2015-09-19 03:53:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 317 bytes |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 22,400 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 10:22:04 |
| 合計ジャッジ時間 | 737 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d", &k, &n, &f);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void)
{
int k, n, f;
scanf("%d %d %d", &k, &n, &f);
int i;
int a[100];
int ans;
ans = k * n;
for (i = 0; i < f; i++) {
scanf("%d", &a[i]);
ans -= a[i];
}
if (ans < 0) {
printf("-1\n");
} else {
printf("%d\n", ans);
}
return 0;
}
namaenadonaize