結果

問題 No.23 技の選択
ユーザー ramia777ramia777
提出日時 2022-05-25 23:06:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,229 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 90,844 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 19:15:41
合計ジャッジ時間 2,031 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

//Yukicoder
//Q23  Select of technique


//二次元可変配列
//vector <vector <int>> mass;
//vector <vector <int>> memo;

//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>//list
#include <set> //tree
#include <map> //連想配列
#include <unordered_set> //hash
#include <unordered_map> //hash
#include <algorithm>
#include <iomanip>

using namespace std;
typedef unsigned long long ULL;
typedef signed long long SLL;


#define START (0)
#define RIGHT (1)
#define UP    (2)
#define LEFT  (3)
#define DOWN  (4)

#define DATA_MAX (1000000)
#define FMAX(a,b)  ((a)>(b)?(a):(b))
#define FMIN(a,b)  ((a)<(b)?(a):(b))
#define FCEIL(a,b)  ((a)+(b)-1)/(b)



float N, D, H ,A;
int ans = 0;




float dp[10005];

int main()
{

	cin >> H;
	cin >> A;
	cin >> D;



	//通常攻撃で敵を倒すのに必要な回数
	int n = FCEIL(H , A);


	//cout << n << endl;

	dp[0] = n; //全部通常攻撃
	int i;

	for (i= 1;i<=n;i++)
	{
		float a;
		float h;

		h = H - A * (n-i);
		
		a = FCEIL((int)h , (int)D) * 1.5f; //必殺技で必要な回数

		dp[i] = FMIN(dp[i - 1], (float)(a+(n-i)));

		//cout << "通常攻撃=" << n-i << ",必殺技=" << a <<  endl;

	}

	cout << dp[n] << endl;


	return 0; //end
}

0