結果
問題 | No.143 豆 |
ユーザー |
|
提出日時 | 2016-03-03 10:58:17 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 20,224 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 10:26:45 |
合計ジャッジ時間 | 671 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &k); | ^~~~~~~~~~~~~~~ main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &f); | ^~~~~~~~~~~~~~~ main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d", &buf); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int k, n, f; int sum; int ans; int buf; int i; scanf("%d", &k); scanf("%d", &n); scanf("%d", &f); sum = 0; for (i = 0; i < f; i++){ scanf("%d", &buf); sum += buf; } if (k * n >= sum){ printf("%d\n", k * n - sum); } else { printf("-1\n"); } return 0; }