結果

問題 No.376 立方体のN等分 (2)
ユーザー rapurasurapurasu
提出日時 2016-08-08 16:55:00
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 625 bytes
コンパイル時間 1,262 ms
コンパイル使用メモリ 160,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 22:14:25
合計ジャッジ時間 8,514 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 92 ms
5,248 KB
testcase_03 AC 88 ms
5,376 KB
testcase_04 RE -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 RE -
testcase_09 AC 23 ms
5,376 KB
testcase_10 AC 39 ms
5,376 KB
testcase_11 RE -
testcase_12 AC 60 ms
5,376 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 WA -
testcase_16 AC 174 ms
5,376 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 95 ms
5,376 KB
testcase_20 RE -
testcase_21 AC 190 ms
5,376 KB
testcase_22 AC 102 ms
5,376 KB
testcase_23 AC 192 ms
5,376 KB
testcase_24 AC 193 ms
5,376 KB
testcase_25 RE -
testcase_26 AC 204 ms
5,376 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 106 ms
5,376 KB
testcase_31 WA -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 104 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long ll;
vector<ll>v;
int main(){
    long long N;
    cin>>N;
    long long ans=N-1;

    for(ll i=1;i<10000001;i++){
        if(i*i>=N)break;
        if(N%i==0)v.push_back(i);
    }
    v.push_back(N);
    for(ll i=1;v[i]*v[i]*v[i]<=N;i++){
       if(N%v[i]!=0)continue;
       long long M=N/v[i];
       for(int j=1;v[i]*v[j]*v[j]<=N;j++){
          if(M%v[j]!=0)continue;
          long long L=M/v[j];
          ans=min(L+v[i]+v[j]-3,ans);
       }
    }
    cout<<ans<<" "<<N-1<<endl;
}
0