結果

問題 No.236 鴛鴦茶
ユーザー sasa
提出日時 2025-03-07 09:46:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 27,008 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-07 09:46:50
合計ジャッジ時間 1,441 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lf%lf",&ratio1,&ratio2);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%lf%lf",&overall1,&overall2);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int main(){
	// 入力された値(割合)
	double ratio1, ratio2;
	scanf("%lf%lf",&ratio1,&ratio2);
	// 入力された値(全体)
	double overall1, overall2;
	scanf("%lf%lf",&overall1,&overall2);
	
	double ans = 0;
	if(overall1 / ratio1 * ratio2 <= overall2){
		ans = overall1 / ratio1 * ratio2 + overall1;
	}else{
		ans = overall2 / ratio2 * ratio1 + overall2;
	}
	
	printf("%f",ans);
}
0