結果

問題 No.375 立方体のN等分 (1)
ユーザー togari_takamototogari_takamoto
提出日時 2016-06-04 22:50:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 101 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 1,101 ms
コンパイル使用メモリ 160,080 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 01:58:01
合計ジャッジ時間 2,395 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef long double ld;
typedef  vector<int> vi; typedef  vector<ll> vl; typedef  vector<bool> vb;
typedef  vector<double> vd;
typedef  vector<vd> vvd;
#define REP(i,n) for(ll i=0; i < (n); ++i)
#define FOR(i,s,e) for (ll i = s; i < (ll)e; i++)
#define TEN(x) ((ll)1e##x)
#define ALL(v) (v).begin(), (v).end()

int main() {
#ifdef _WIN32
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0); // cinとcoutの連携を切る
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll n; cin >> n;
	ll sqrt3 = pow(n, 1.0 / 3) + 1;
	ll mi = n;
	FOR(i, 1, sqrt3+1) if (n%i == 0) {
		ll rest = n / i;
		ll sqrt2 = sqrt(rest)+1;
		FOR(j, 1, sqrt2+1) if(rest%j == 0) {
			mi = min(mi, i + j + rest/j - 3);
		}
	}

	cout << mi << " " << n - 1 << endl;
}
0