結果

問題 No.375 立方体のN等分 (1)
ユーザー albicillaalbicilla
提出日時 2016-06-09 12:28:58
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 63,056 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 12:13:37
合計ジャッジ時間 3,208 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long ll;

vector<ll> vec;

int main(){
	ll N;
	cin>>N;
	for(ll i=0;(i-1)*(i-1)<=N;i++){
		if(N%(i+1)==0)vec.push_back(i+1);
	}
	ll t=1e9;
	for(ll i=0;i<vec.size();i++){
		for(ll j=i;j<vec.size();j++){
			for(ll k=j;k<vec.size();k++){
				if(vec[i]*vec[j]*vec[k]==N){
					ll temp=vec[i]+vec[j]+vec[k];
					t=min(t,temp-3);
				}
			}
		}
	}
	t=min(t,N-1);
	cout<<t<<" "<<N-1<<endl;
	return 0;
}
0