結果

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

ソースコード

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)){
            //i
            for(long long j = 1; n/i >= j*j; j++){
                if(!(i%j)){
                    //cout << i << " " << j << " " << n/(i*j) << endl;
                    a = min({a,i+j+n/(i*j)-3});
                }
            }
            //n%i
            for(long long j = 1; i >= j*j; j++){
                if(!((n/i)%j)){
									//cout << (n/i) << " " << j << " " << n/((n/i)*j) << endl;
                  a = min({a,(n/i)+j+n/((n/i)*j)-3});
                }
            }
        }
    }
    cout << a << " " << n-1 << endl;
}
0