結果

問題 No.23 技の選択
ユーザー scache
提出日時 2014-11-12 03:50:59
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 611 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 74,688 KB
実行使用メモリ 56,076 KB
最終ジャッジ日時 2024-12-31 09:58:41
合計ジャッジ時間 8,436 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Main p = new Main();
	}
	double c, prob;
 
	public Main() {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();
		int d = sc.nextInt();
 
		c = 1.0; prob = 0.0;
		for(int i=0;i<200;i++){
			prob += 1*c;
			c /= 3.0;
		}
 
		solve(h, a, d);
	}
 
	public void solve(int h, int a, int d) {
 
		double res = (h-1)/a+1;
		int m = (h-1)/a + 1;
		for(int i=0;i<=m;i++){
			res = Math.min(res, i+((h-i*a-1)/d+1)*prob);
		}
 
		System.out.println(res);
	}
 
}
0