結果
| 問題 |
No.143 豆
|
| ユーザー |
sasa
|
| 提出日時 | 2025-03-03 16:30:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 332 ms |
| コンパイル使用メモリ | 26,496 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-03-03 16:30:39 |
| 合計ジャッジ時間 | 1,286 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d",&val);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
// 1袋に入っている豆の数
int num = 0;
// 袋の数
int bag = 0;
// 家族の人数
int family = 0;
int sum = num * bag;
while(family > 0){
int val = 0;
scanf("%d",&val);
sum -= val;
family--;
}
if(sum < 0){
printf("-1");
}else{
printf("%d",sum);
}
}
sasa