結果

問題 No.375 立方体のN等分 (1)
ユーザー rapurasu
提出日時 2016-08-08 16:32:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 465 bytes
コンパイル時間 1,284 ms
コンパイル使用メモリ 158,968 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-11-07 07:21:28
合計ジャッジ時間 17,741 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
int main(){
    long long N;
    cin>>N;
    long long ans=N-1;
    for(long long i=1;i<int(sqrt(N))+1;i++){
       if(N%i!=0)continue;
       long long M=N/i;
       for(long long j=1;j<int(sqrt(N))+1;j++){
          if(M%j!=0)continue;
          long long L=M/j;
          ans=min(L+i+j-3,ans);
       }
    }
    cout<<ans<<" "<<N-1<<endl;
}
0