結果
問題 | No.32 貯金箱の憂鬱 |
ユーザー | yj1145141919 |
提出日時 | 2016-07-08 11:18:52 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 680 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 01:56:36 |
合計ジャッジ時間 | 927 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:20:9: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | fgets(str, sizeof(str), stdin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:24:9: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | fgets(str, sizeof(str), stdin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:28:9: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | fgets(str, sizeof(str), stdin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* * chokin.c * * Created on: 2016/07/08 * Author: admin */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void){ int hyaku=0; int nijugo=0; int ichi=0; int satsu=0; int sum=0; char str[1000]; //100円硬貨 fgets(str, sizeof(str), stdin); hyaku = atoi(str); //25円硬貨 fgets(str, sizeof(str), stdin); nijugo = atoi(str); //1円硬貨 fgets(str, sizeof(str), stdin); ichi = atoi(str); if(ichi > 25){ nijugo += ichi / 25; ichi = ichi % 25; } if(nijugo > 4){ hyaku += nijugo / 4; nijugo = nijugo % 4; } if(hyaku > 10){ hyaku = hyaku % 10; } sum = hyaku + nijugo + ichi; printf("%d\n", sum); return 0; }