結果

問題 No.375 立方体のN等分 (1)
ユーザー ixmelixmel
提出日時 2016-07-10 14:54:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 973 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 83,008 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-03 13:31:41
合計ジャッジ時間 2,255 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const ll inf=1e17;
int main(){
	ll in;
	cin>>in;
	ll out=inf;
	for(ll i=1;i*i<=in;i++)if(in%(i+1)==0){
		ll t=in/(i+1);
		out=min(out,i+t-1);
		for(ll j=1;j*j<=t;j++)if(t%(j+1)==0){
			out=min(out,i+j+t/(j+1)-1);
		}
	}
	if(out==inf)out=in-1;
	cout<<out<<" "<<in-1<<endl;
}




0