結果

問題 No.169 何分かかるの!?
ユーザー Maeda
提出日時 2025-03-07 16:40:02
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 458 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 27,904 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-07 16:40:04
合計ジャッジ時間 1,593 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%le\n%le\n",&k,&s);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#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("%le\n%le\n",&k,&s);
	double remaining = 100 - k ;
	double percentTime = s / remaining;
	char numStr[MAX_LEN];
	uint2str(numStr,MAX_LEN,percentTime * 100);
	int i = 0;
	while(numStr[i] != '.'){
		printf("%c",numStr[i]);
		i++;
	}
}
0