結果

問題 No.376 立方体のN等分 (2)
ユーザー rapurasurapurasu
提出日時 2016-08-08 17:22:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 673 bytes
コンパイル時間 1,209 ms
コンパイル使用メモリ 147,436 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-07 03:58:58
合計ジャッジ時間 6,120 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 88 ms
4,380 KB
testcase_03 AC 84 ms
4,380 KB
testcase_04 AC 101 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 6 ms
4,380 KB
testcase_09 AC 23 ms
4,380 KB
testcase_10 AC 36 ms
4,380 KB
testcase_11 AC 47 ms
4,380 KB
testcase_12 AC 62 ms
4,384 KB
testcase_13 AC 64 ms
4,380 KB
testcase_14 AC 71 ms
4,376 KB
testcase_15 AC 80 ms
4,376 KB
testcase_16 AC 154 ms
4,380 KB
testcase_17 AC 89 ms
4,380 KB
testcase_18 AC 91 ms
4,380 KB
testcase_19 AC 94 ms
4,380 KB
testcase_20 AC 96 ms
4,380 KB
testcase_21 AC 165 ms
4,380 KB
testcase_22 AC 100 ms
4,380 KB
testcase_23 AC 173 ms
4,380 KB
testcase_24 AC 170 ms
4,380 KB
testcase_25 AC 104 ms
4,384 KB
testcase_26 AC 181 ms
4,380 KB
testcase_27 AC 105 ms
4,380 KB
testcase_28 AC 104 ms
4,380 KB
testcase_29 AC 105 ms
4,380 KB
testcase_30 AC 105 ms
4,380 KB
testcase_31 AC 105 ms
4,376 KB
testcase_32 AC 106 ms
4,380 KB
testcase_33 AC 106 ms
4,376 KB
testcase_34 AC 106 ms
4,376 KB
testcase_35 AC 105 ms
4,384 KB
testcase_36 AC 105 ms
4,376 KB
testcase_37 AC 105 ms
4,384 KB
testcase_38 AC 105 ms
4,376 KB
testcase_39 AC 105 ms
4,380 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;
    for(ll i=1;i*i<=N;i++){
        if(N%i==0){
           v.push_back(i);
        }
        
    }
    v.push_back(10000001);
    long long ans=N-1;
    for(int i=0;v[i]<=100000&&v[i]*v[i]*v[i]<=N;i++){
       if(N%v[i]!=0)continue;
       long long M=N/v[i];
       for(long long j=i;v[j]<=10000000&&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