結果

問題 No.376 立方体のN等分 (2)
ユーザー face4
提出日時 2019-02-21 16:49:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 374 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 65,088 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 23:49:41
合計ジャッジ時間 33,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;

    ll ans = n;
    for(ll i = 1; i*i*i <= n; i++){
        if(n%i) continue;
        for(ll j = 1; j*j <= n/i; j++){
            if((n/i)%j)    continue;
            ans = min(ans, i-1+j-1+(n/i/j)-1);
        }
    }

    cout << ans << " " << n-1 << endl;

    return 0;
}
0