結果

問題 No.376 立方体のN等分 (2)
ユーザー Lay_ecLay_ec
提出日時 2016-06-05 00:30:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 68,988 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 03:30:08
合計ジャッジ時間 34,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 448 ms
6,940 KB
testcase_03 AC 856 ms
6,940 KB
testcase_04 AC 613 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 14 ms
6,940 KB
testcase_09 AC 56 ms
6,940 KB
testcase_10 AC 670 ms
6,940 KB
testcase_11 AC 169 ms
6,940 KB
testcase_12 AC 368 ms
6,944 KB
testcase_13 AC 179 ms
6,940 KB
testcase_14 AC 220 ms
6,940 KB
testcase_15 AC 166 ms
6,944 KB
testcase_16 AC 4,143 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 188 ms
6,944 KB
testcase_19 AC 704 ms
6,944 KB
testcase_20 AC 224 ms
6,940 KB
testcase_21 AC 4,659 ms
6,944 KB
testcase_22 AC 204 ms
6,944 KB
testcase_23 AC 4,909 ms
6,944 KB
testcase_24 AC 4,947 ms
6,940 KB
testcase_25 WA -
testcase_26 TLE -
testcase_27 AC 283 ms
6,944 KB
testcase_28 AC 209 ms
6,940 KB
testcase_29 AC 393 ms
6,944 KB
testcase_30 AC 288 ms
6,944 KB
testcase_31 AC 208 ms
6,940 KB
testcase_32 AC 284 ms
6,944 KB
testcase_33 WA -
testcase_34 AC 209 ms
6,940 KB
testcase_35 AC 339 ms
6,944 KB
testcase_36 AC 208 ms
6,944 KB
testcase_37 AC 208 ms
6,940 KB
testcase_38 AC 353 ms
6,940 KB
testcase_39 AC 386 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

#include <cmath>



int main()
{
    
    long long n;
    scanf("%lld",&n);
    long long Tmin=2*n;
    
    int N=sqrt(n);
	
	if((long long)N*(long long)N==n){
		printf("%d",N*2-2);
		return 0;
	}
	
    N+=2;
    int a,b,M;
	long long m;
		
    for(a=1;a<N;++a){
        if(n%a) continue;
        m=n/a;
        M=sqrt(m)+2;
        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