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