結果

問題 No.23 技の選択
ユーザー YoshiRyuYoshiRyu
提出日時 2017-03-31 13:36:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,000 bytes
コンパイル時間 1,010 ms
コンパイル使用メモリ 144,252 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-21 10:35:38
合計ジャッジ時間 2,360 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
 
// マクロ群
#define REP(i,n) for(int i=0;i<n;++i)
#define REP2(i,a,b) for (int i=(a);i<(b);++i)
#define rep(n) REP(i,n)
#define SF(f,v) scanf(f,v)
#define SF_N(v) SF("%d",&v)
#define SF_S(v) SF("%s",v)
#define PF(f,v) printf(f,v)
#define PFS_N(v) PF("%d ",v)
#define PFS_S(v) PF("%s ",v)
#define PFL_N(v) PF("%d\n",v)
#define PFL_S(v) PF("%s\n",v)
 
using namespace std;
 
const int INF = 1e9;
 
int H, A, D;
 
void Slove()
{
	SF_N(H); SF_N(A); SF_N(D);
 
	double dp[10010];
	dp[H] = 0;
 
	/// 全部必殺技で攻撃した回数を出す
 
	for (int i = H; i > 0; i -= D) dp[H] += 1.5;
 
	double ans = dp[H];
 
	/// 通常攻撃の回数を1回ずつ増やしていき、残りは必殺技で攻撃する
 
	int h = H;
	int cnt = 0;
	while (++cnt < dp[H] && (h -= A) >= 0)
	{
		dp[h] = cnt;
		for (int j = h; j > 0; j -= D) dp[h] += 1.5;
 
		ans = min(ans, dp[h]);	// 最小値を得る
	}
 
	// 回答出力
	PF("%f\n", ans );
}
 
int main() { Slove(); return 0; }
0