結果
問題 |
No.376 立方体のN等分 (2)
|
ユーザー |
![]() |
提出日時 | 2016-08-08 16:38:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 491 bytes |
コンパイル時間 | 1,903 ms |
コンパイル使用メモリ | 158,580 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-07 07:25:06 |
合計ジャッジ時間 | 36,598 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 TLE * 4 -- * 13 |
ソースコード
#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<pow(N,1.0/3.0)+3;i++){ if(N%i!=0)continue; if(i>N)continue; long long M=N/i; for(long long j=1;j<int(sqrt(M))+1;j++){ if(M%j!=0)continue; long long L=M/j; ans=min(L+i+j-3,ans); } } cout<<ans<<" "<<N-1<<endl; }