結果

問題 No.375 立方体のN等分 (1)
ユーザー tabataba
提出日時 2017-05-19 22:50:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 1,117 ms
コンパイル使用メモリ 111,644 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 02:52:17
合計ジャッジ時間 3,229 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 21 ms
4,348 KB
testcase_16 AC 14 ms
4,348 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 9 ms
4,348 KB
testcase_21 AC 9 ms
4,348 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 9 ms
4,348 KB
testcase_25 AC 41 ms
4,348 KB
testcase_26 AC 14 ms
4,348 KB
testcase_27 WA -
testcase_28 AC 8 ms
4,348 KB
testcase_29 AC 9 ms
4,348 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 8 ms
4,348 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>
#include <set>
#include <iostream>

using namespace std;

int main(){
	int64_t n,t;
	-scanf("%ld",&n);
	t=n;
	int64_t a,b,c,nr3=pow(n,1./3)*2,minabc=n*2;
	for(a=1;a<nr3;a++){
		int64_t na=n%a;
		if(na)continue;
		int64_t nr2=sqrt(n/a)*2;
		for(b=1;b<nr2;b++){
			int64_t nb=n%b;
			if(nb)continue;
			c=n/a/b;
			minabc=min(minabc,a+b+c-3);
		}
		
	}
	printf("%ld %ld\n",minabc,n-1);
	return 0;
}
0