結果

問題 No.376 立方体のN等分 (2)
ユーザー kotatsugamekotatsugame
提出日時 2020-02-16 07:24:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 479 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 78,060 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 03:29:44
合計ジャッジ時間 9,797 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 88 ms
6,940 KB
testcase_03 AC 86 ms
6,944 KB
testcase_04 AC 101 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 6 ms
6,944 KB
testcase_09 AC 23 ms
6,940 KB
testcase_10 AC 85 ms
6,940 KB
testcase_11 AC 47 ms
6,940 KB
testcase_12 AC 62 ms
6,940 KB
testcase_13 AC 65 ms
6,944 KB
testcase_14 AC 72 ms
6,940 KB
testcase_15 AC 80 ms
6,944 KB
testcase_16 AC 903 ms
6,940 KB
testcase_17 RE -
testcase_18 AC 91 ms
6,940 KB
testcase_19 RE -
testcase_20 AC 96 ms
6,944 KB
testcase_21 AC 924 ms
6,944 KB
testcase_22 AC 100 ms
6,940 KB
testcase_23 AC 950 ms
6,944 KB
testcase_24 AC 910 ms
6,944 KB
testcase_25 AC 104 ms
6,940 KB
testcase_26 AC 1,042 ms
6,940 KB
testcase_27 AC 105 ms
6,944 KB
testcase_28 AC 106 ms
6,944 KB
testcase_29 AC 106 ms
6,940 KB
testcase_30 AC 106 ms
6,944 KB
testcase_31 AC 105 ms
6,944 KB
testcase_32 AC 105 ms
6,940 KB
testcase_33 AC 105 ms
6,944 KB
testcase_34 AC 105 ms
6,940 KB
testcase_35 AC 105 ms
6,944 KB
testcase_36 AC 105 ms
6,940 KB
testcase_37 AC 105 ms
6,940 KB
testcase_38 AC 105 ms
6,944 KB
testcase_39 AC 105 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long N;
main()
{
	cin>>N;
	vector<long>div;
	for(long i=1;i*i<=N;i++)
	{
		if(N%i==0)
		{
			div.push_back(i);
			if(N/i>i)div.push_back(N/i);
		}
	}
	long ans=N-1;
	sort(div.begin(),div.end());
	for(int i=0;i<div.size();i++)
	{
		int j=i;
		while(j<div.size()&&div[i]*div[j]<=N)
		{
			if(N%(div[i]*div[j])==0)ans=min(ans,div[i]+div[j]+N/div[i]/div[j]-3);
			j++;
		}
	}
	cout<<ans<<" "<<N-1<<endl;
}
0