結果

問題 No.456 Millions of Submits!
ユーザー PachicobuePachicobue
提出日時 2017-08-14 01:51:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3,875 ms / 4,500 ms
コード長 1,681 bytes
コンパイル時間 1,702 ms
コンパイル使用メモリ 165,268 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 01:00:38
合計ジャッジ時間 10,084 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 41 ms
4,380 KB
testcase_10 AC 40 ms
4,380 KB
testcase_11 AC 387 ms
4,380 KB
testcase_12 AC 3,875 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// {{{ Templates
#include <bits/stdc++.h>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

// }}}

inline long double binlarge(const ll a, const ll b, const long double t)
{
    const long double lgt = log(t);
    long double inf = 0.0;
    long double sup = exp(t) + 0.01;
    for (int i = 0; i < 55; i++) {
        const long double mid = (inf + sup) / 2;
        const long double c = a * mid + b * log(mid);
        if (c < lgt) {
            inf = mid;
        } else {
            sup = mid;
        }
    }
    return exp(inf);
}

inline long double binsmall(const ll a, const long double t)
{
    const long double inf = log(t) / a;
    return exp(inf);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll m;
    cin >> m;
    for (ll i = 0; i < m; i++) {
        ll a, b;
        cin >> a >> b;
        long double t;
        cin >> t;
        if (b == 0 and t < 1.0) {
            cout << fixed << setprecision(12) << binsmall(a, t) << "\n";
        } else {
            cout << fixed << setprecision(12) << binlarge(a, b, t) << "\n";
        }
    }
    return 0;
}
0