結果

問題 No.376 立方体のN等分 (2)
ユーザー hanorver
提出日時 2016-06-05 09:32:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 62,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 15:06:16
合計ジャッジ時間 30,469 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cmath>

int main() {
	long long n;

	std::cin >> n;

	long long max = n - 1, min = n - 1;

	long long a, b, c, end, end2;

	end2 = std::pow(n, 1.0 / 3.0);

	for (long long i = 1; i <= end2; i++) {
		if (n % i != 0) continue;
		long long tn = n / i;
		end = sqrt(tn);
		for (long long j = i; j <= end; j++) {
			if (tn % j != 0) continue;
			min = std::min(min, i + j + tn / j - 3);
		}
	}

	std::cout << min << " " << max << std::endl;
	return 0;
}
0