Submission #738505


Source Code Expand

Copy
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <iomanip>

using namespace std;

#define int long long

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

double P;

double f(double x)
{
    return x + P / pow(2, 1. * x / 1.5);
}

signed main()
{
    cin >> P;

    // 三分探索
    double lb = 0, ub = 100;
    rep(_, 100) {
        double m1 = (lb * 2 + ub) / 3;
        double m2 = (lb + ub * 2) / 3;

        if (f(m1) < f(m2)) {
            ub = m2;
        } else {
            lb = m1;
        }
    }
    
    cout << fixed << setprecision(10) << f(lb) << endl;
}

Submission Info

Submission Time
Task B - ムーアの法則
User Izryt
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1907 Byte
Status
Exec Time 6 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 100 / 100 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt
Case Name Status Exec Time Memory
01.txt 4 ms 256 KB
02.txt 4 ms 256 KB
03.txt 4 ms 256 KB
04.txt 4 ms 256 KB
05.txt 4 ms 256 KB
06.txt 4 ms 256 KB
07.txt 4 ms 256 KB
08.txt 4 ms 256 KB
09.txt 4 ms 256 KB
10.txt 5 ms 256 KB
11.txt 4 ms 256 KB
12.txt 4 ms 256 KB
13.txt 4 ms 256 KB
14.txt 4 ms 256 KB
15.txt 4 ms 256 KB
16.txt 4 ms 256 KB
17.txt 4 ms 256 KB
18.txt 4 ms 256 KB
19.txt 4 ms 256 KB
20.txt 4 ms 256 KB
21.txt 4 ms 256 KB
22.txt 6 ms 256 KB
23.txt 4 ms 256 KB
24.txt 4 ms 256 KB
25.txt 4 ms 256 KB
sample_01.txt 4 ms 256 KB
sample_02.txt 4 ms 256 KB
sample_03.txt 4 ms 256 KB