結果
問題 | No.143 豆 |
ユーザー |
|
提出日時 | 2017-06-28 16:21:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 1,493 ms |
コンパイル使用メモリ | 158,740 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 10:46:51 |
合計ジャッジ時間 | 1,904 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’: main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d%d\n", &K, &N, &F); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d", &A); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { int K, N, F; scanf("%d%d%d\n", &K, &N, &F); int remain = K * N; for (int i = 0; i < F; i++) { int A; scanf("%d", &A); remain -= A; if (remain < 0) { remain = -1; break; } } printf("%d\n", remain); return 0; }