結果

問題 No.23 技の選択
ユーザー masa
提出日時 2015-01-26 21:23:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 65,820 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 16:46:11
合計ジャッジ時間 1,373 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>

using namespace std;

int main() {
	int hp, attack, critical;

	cin >> hp >> attack >> critical;

	double ans = 1e9;
	for (int i = ceil(1.0 * hp / critical); i >= 0; i--) {
		int j = max(0, (int) ceil(1.0 * (hp - critical * i) / attack));
		ans = min(ans, 1.5 * i + j);
	}

	cout << ans << endl;
	return 0;
}
0