結果

問題 No.555 世界史のレポート
ユーザー nanophoto12nanophoto12
提出日時 2017-08-11 23:20:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,155 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 90,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 23:37:40
合計ジャッジ時間 1,322 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;

int main()
{
    int n;
    cin >> n;
    int c, v;
    cin >> c >> v;
    
    ll minCost = 1e13;
    for(int i = 1;i < n;i++)
    {
        ll count = 1;
        ll cost = 0;
        ll b = 0;
        for(int j = 0;j < i;j++)
        {
            b = count;
            cost += c;
            count += b;
            cost += v;
            if(count >= n)
            {
                break;
            }
        }
        if(count < n)
        {
            ll aa = (n-count)/ b;
            if((n - count) % b > 0)
            {
                aa++;
            }
            cost += aa * v;
        }
        //cout << i << "," << count << "," << cost << endl;
        minCost = min(minCost, cost);
    }
    cout << minCost << endl;
    return 0;
}
0