結果

問題 No.1664 Unstable f(n)
ユーザー mtmtmtmtmtmtmtmtmtmt
提出日時 2021-09-04 15:32:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,928 bytes
コンパイル時間 1,545 ms
コンパイル使用メモリ 166,272 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 01:23:12
合計ジャッジ時間 20,394 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 399 ms
4,380 KB
testcase_01 AC 399 ms
4,380 KB
testcase_02 AC 399 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 399 ms
4,380 KB
testcase_08 AC 398 ms
4,380 KB
testcase_09 AC 399 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 399 ms
4,384 KB
testcase_22 AC 398 ms
4,380 KB
testcase_23 AC 399 ms
4,380 KB
testcase_24 AC 400 ms
4,376 KB
testcase_25 AC 399 ms
4,380 KB
testcase_26 AC 400 ms
4,376 KB
testcase_27 AC 400 ms
4,380 KB
testcase_28 AC 399 ms
4,380 KB
testcase_29 AC 398 ms
4,376 KB
testcase_30 AC 399 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SUM(v) accumulate(ALL(v),0ll)
#define CL(v) cout<<v<<endl
using ll = long long;
const ll INF=10101010;
const ll mod=1e9+7;
using namespace std;
using P = pair<int,int>;
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
class UnionFind {
public:
    vector <ll> par; 
    vector <ll> siz;

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; 
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL); 
        for (ll i = 0; i < sz_; ++i) par[i] = i; 
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
      
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { 
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};
ll gcd(ll a,ll b)
{
  if(a==0)return b;
  return gcd(b%a,a);
}


//--------------------------------//mod


int main()
{  
    ll n;
    cin>>n;
    ll ans=INF;
    ll ansi=0;
    ll ansj=0;
    REP(i,1000000)
    {
        ll tmp=i;
        if(i==0)continue;
        for(ll j=0;j<=100;j++)
        {
            if(j==0)continue;
            tmp*=i;
            ll tmp2=n-tmp;
            //cout<<i<<" "<<j<<" "<<tmp<<" "<<tmp2<<endl;
            if(tmp2>0)
            {
                ans=min(ans,i+j+tmp2+1);
              //  cout<<i<<" "<<j<<" "<<tmp<<" "<<tmp2<<endl;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
0