結果
問題 |
No.169 何分かかるの!?
|
ユーザー |
![]() |
提出日時 | 2025-03-07 16:39:15 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 510 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 28,416 KB |
実行使用メモリ | 8,612 KB |
最終ジャッジ日時 | 2025-03-07 16:39:17 |
合計ジャッジ時間 | 941 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 22 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:17: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘double *’ [-Wformat=] 13 | scanf("%d\n%d\n",&k,&s); | ~^ ~~ | | | | int * double * | %le main.c:13:21: warning: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘double *’ [-Wformat=] 13 | scanf("%d\n%d\n",&k,&s); | ~^ ~~ | | | | int * double * | %le main.c:16:19: warning: unknown conversion type character ‘\xe5’ in format [-Wformat=] 16 | printf("1%当たりの時間:%f\n",s / remaining); | ^ main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d\n%d\n",&k,&s); | ^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #define MAX_LEN (256) void uint2str(char str[], size_t len, double num) { snprintf(str, len, "%f", num); } void main(void){ double k,s; scanf("%d\n%d\n",&k,&s); double remaining = 100 - k ; double percentTime = s / remaining; printf("1%当たりの時間:%f\n",s / remaining); char numStr[MAX_LEN]; uint2str(numStr,MAX_LEN,percentTime * 100); int i = 0; while(numStr[i] != '.'){ printf("%c",numStr[i]); i++; } }