結果

問題 No.375 立方体のN等分 (1)
ユーザー 👑 CleyL
提出日時 2020-03-22 23:52:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 169 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 787 ms
コンパイル使用メモリ 66,416 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 05:41:57
合計ジャッジ時間 2,802 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    long long n;cin>>n;
    long long a = n;
    for(long long i = 1; n >= i*i; i++){
        if(!(n%i)){
            for(long long j = 1; n/i >= j*j; j++){
                if(!((n/i)%j)){
                    //cout << i << j << (n/i*j) << endl;
                    a = min({a,i+j+n/(i*j)-3});
                }
            }
        }
    }
    cout << a << " " << n-1 << endl;
}
0