結果

問題 No.376 立方体のN等分 (2)
ユーザー Lay_ecLay_ec
提出日時 2016-06-05 00:02:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4,422 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 69,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 03:16:41
合計ジャッジ時間 30,066 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 386 ms
5,376 KB
testcase_03 AC 726 ms
5,376 KB
testcase_04 AC 522 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 49 ms
5,376 KB
testcase_10 AC 569 ms
5,376 KB
testcase_11 AC 146 ms
5,376 KB
testcase_12 AC 312 ms
5,376 KB
testcase_13 AC 156 ms
5,376 KB
testcase_14 AC 188 ms
5,376 KB
testcase_15 AC 143 ms
5,376 KB
testcase_16 AC 3,558 ms
5,376 KB
testcase_17 AC 330 ms
5,376 KB
testcase_18 AC 162 ms
5,376 KB
testcase_19 AC 597 ms
5,376 KB
testcase_20 AC 193 ms
5,376 KB
testcase_21 AC 3,911 ms
5,376 KB
testcase_22 AC 175 ms
5,376 KB
testcase_23 AC 4,130 ms
5,376 KB
testcase_24 AC 4,257 ms
5,376 KB
testcase_25 AC 184 ms
5,376 KB
testcase_26 AC 4,422 ms
5,376 KB
testcase_27 AC 243 ms
5,376 KB
testcase_28 AC 182 ms
5,376 KB
testcase_29 AC 337 ms
5,376 KB
testcase_30 AC 247 ms
5,376 KB
testcase_31 AC 182 ms
5,376 KB
testcase_32 AC 247 ms
5,376 KB
testcase_33 AC 181 ms
5,376 KB
testcase_34 AC 180 ms
5,376 KB
testcase_35 AC 289 ms
5,376 KB
testcase_36 AC 189 ms
5,376 KB
testcase_37 AC 181 ms
5,376 KB
testcase_38 AC 301 ms
5,376 KB
testcase_39 AC 330 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
int main()
{
    
    long long n;
    scanf("%lld",&n);
    long long Tmin=2*n;
    
    long long N=sqrt(n);
    N++;
    long long a,b,m,M;
    for(a=1;a<=N;++a){
        if(n%a) continue;
        m=n/a;
        M=sqrt(m)+1;
        for(b=a;b<=M;++b){
            if(m%b==0 && Tmin>a+b+m/b) Tmin=a+b+m/b;
        }
    }
    printf("%lld %lld\n",Tmin-3,n-1);
    //cout<<Tmin-3<<" "<<n-1<<endl;

    
    return 0;
}
0