結果

問題 No.375 立方体のN等分 (1)
ユーザー lucky3977
提出日時 2016-06-05 01:26:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 69,844 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:58:00
合計ジャッジ時間 2,009 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main(){
	long long n;
	cin >> n;
	long long minans = n, maxans;
	maxans = n - 1;
	for(long long i = 1; i * i * i <= n; i++)
	{
		if(n % i != 0) continue;
		long long t = n / i;
		for(long long j = 1; j * j <= t; j++){
			if(t % j != 0) continue;
			long long  c;
			c = t / j;
			minans = min(minans, i - 1 + j - 1 + c - 1);
		}
	}
	cout << minans << " " << maxans << endl;
	return 0;
}
0