結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 391 ms
5,376 KB
testcase_03 AC 751 ms
5,376 KB
testcase_04 AC 541 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 52 ms
5,376 KB
testcase_10 AC 581 ms
5,376 KB
testcase_11 AC 153 ms
5,376 KB
testcase_12 AC 324 ms
5,376 KB
testcase_13 AC 155 ms
5,376 KB
testcase_14 AC 192 ms
5,376 KB
testcase_15 AC 144 ms
5,376 KB
testcase_16 AC 3,600 ms
5,376 KB
testcase_17 AC 341 ms
5,376 KB
testcase_18 AC 172 ms
5,376 KB
testcase_19 AC 617 ms
5,376 KB
testcase_20 AC 195 ms
5,376 KB
testcase_21 AC 4,006 ms
5,376 KB
testcase_22 AC 186 ms
5,376 KB
testcase_23 AC 4,211 ms
5,376 KB
testcase_24 AC 4,276 ms
5,376 KB
testcase_25 AC 185 ms
5,376 KB
testcase_26 AC 4,450 ms
5,376 KB
testcase_27 AC 256 ms
5,376 KB
testcase_28 AC 187 ms
5,376 KB
testcase_29 AC 356 ms
5,376 KB
testcase_30 AC 260 ms
5,376 KB
testcase_31 AC 187 ms
5,376 KB
testcase_32 AC 255 ms
5,376 KB
testcase_33 AC 187 ms
5,376 KB
testcase_34 AC 189 ms
5,376 KB
testcase_35 AC 308 ms
5,376 KB
testcase_36 AC 189 ms
5,376 KB
testcase_37 AC 194 ms
5,376 KB
testcase_38 AC 310 ms
5,376 KB
testcase_39 AC 348 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>


int main()
{
    
    long long n;
    scanf("%lld",&n);
    long long Tmin=2*n;
    
    int N=sqrt(n);
    N++;
    int a,b,M;
	long long 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