結果

問題 No.3359 ブリング根の3桁精度近似計算
コンテスト
ユーザー shinchan
提出日時 2025-11-14 22:32:44
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,214 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 280,048 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-14 22:32:57
合計ジャッジ時間 3,607 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define all(v) (v).begin(),(v).end()
#define pb emplace_back
#define rep(i, n) for(int i=0;i<(n);i++)
#define foa(e, v) for(auto& e : v)
#define dout(a) cout<<fixed<<setprecision(10)<<a<<'\n';
#define Cout(a) cout<<a<<'\n';

using ll = long long;
using ld = long double;
using Int = __int128;
template <class T> using pqr = priority_queue<T, vector<T>, greater<T>>;

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    bool compare = a < b;
    if(compare) a = b;
    return compare;
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    bool compare = a > b;
    if(compare) a = b;
    return compare;
}
template <typename T> inline T back(std::set<T> &s) {
    return *s.rbegin();
}
template <typename T> inline T back(std::multiset<T> &s) {
    return *s.rbegin();
}
template <typename T> inline T pop_back(std::set<T> &s) {
    auto it = prev(s.end());
    T val = *it;
    s.erase(it); 
    return val;
}
template <typename T> inline T pop_back(std::multiset<T> &s) {
    auto it = prev(s.end());
    T val = *it;
    s.erase(it); 
    return val;
}

const int dy[8] = {-1, 0, 0, 1, 1, -1, 1, -1};
const int dx[8] = {0, -1, 1, 0, -1, -1, 1, 1};

const ll MOD7 = 1000000007, MOD998 = 998244353, INF = (3LL << 59);
const int inf = 1 << 30;
const char br = '\n';

void solve() {
    ll c; cin >> c;
    Int C = 1000000000000000LL;
    C *= c;
    ll m = 1000000000000LL;
    for(ll i = 0; i < 10000; i ++) {
        Int a = i;
        Int b = a * a * a * a * a + a * m;
        if(b > C) {
            string s = "";
            i --;
            while(i) {
                s += char('0' + (i % 10));
                i /= 10;
            }
            while((int)s.size() <= 3) s += "0";
            reverse(all(s));
            if((int)s.size() == 4) {
                cout << s[0] << "." << s.substr(1, 3) << endl;
            } else {
                cout << s.substr(0, 2) << "." << s.substr(2, 3) << endl;
            }
            return;
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int testcase = 1; 
    // cin >> testcase;
    while(testcase --) solve();

    return 0;
}
0