結果
| 問題 |
No.143 豆
|
| ユーザー |
HiroakiSoftware
|
| 提出日時 | 2015-02-05 23:26:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 328 bytes |
| コンパイル時間 | 113 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 10:13:56 |
| 合計ジャッジ時間 | 735 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:15: 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:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf ( "%d" , &Data );
| ~~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main ( void ) {
int K , N , F , Data , Sum = 0;
scanf ( "%d %d %d" , &K , &N , &F );
for ( int i = 0; i < F; i++ ) {
scanf ( "%d" , &Data );
Sum += Data;
}
int NumberOfBeans = K * N;
if ( NumberOfBeans < Sum ) printf ( "-1\n");
else printf ( "%d\n" , NumberOfBeans - Sum );
return 0;
}
HiroakiSoftware