結果

問題 No.376 立方体のN等分 (2)
ユーザー Lay_ecLay_ec
提出日時 2016-06-04 23:59:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 623 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 89,656 KB
実行使用メモリ 10,148 KB
最終ジャッジ日時 2024-10-08 12:54:01
合計ジャッジ時間 35,953 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 TLE * 4 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

int main()
{
	
	long long n;
	scanf("%lld",&n);
	long long Tmin=2*n;
	
	long long a=sqrt(n)+2LL,b,m,M;
	
	while(a--){
		if(a==0) break;
		if(n%a) continue;
		m=n/a;
		b=sqrt(m)+2;
		while(b--){
			if(b==0) break;
			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