結果

問題 No.555 世界史のレポート
ユーザー kotamanegikotamanegi
提出日時 2017-08-12 00:06:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,691 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 125,496 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 00:05:25
合計ジャッジ時間 1,783 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 3 ms
6,940 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 4 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define eps 0.00000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	long long n, c, v;
	cin >> n >> c >> v;
	long long ans = (n - 1)*v;
	for (int copy = 1;copy < 20 && copy < n;++copy) {
		int top = n, bot = 1;
		while (top - bot > 1) {
			int mid = (top + bot) / 2;
			int j = 0;
			long long now = 1, board = 1;
			for (j = 0;now < n;j++) {
				now += board;
				if ((j + 1) % mid == 0 && (j + 1) / mid <= copy) {
					board = now;
				}
			}
			if (j / mid > copy) {
				bot = mid;
			}
			else top = mid;
		}
		int mid = top;
		int hogehoge = 0;
		int j = 0;
		long long now = 1, board = 1;
		for (j = 0;now < n;j++) {
			now += board;
			if ((j + 1) % mid == 0 && (j + 1) / mid <= copy) {
				board = now;
			}
			hogehoge++;
		}
		int hoge_hoge = 0;
		mid = bot;
		j = 0;
		now = 1, board = 1;
		for (j = 0;now < n;j++) {
			now += board;
			if ((j + 1) % mid == 0 && (j + 1) / mid <= copy) {
				board = now;
			}
			hoge_hoge++;
		}
		ans = min(ans, min(hogehoge, hoge_hoge)*v + copy*c);
	}
	cout << ans + c << endl;
	return 0;
}
0