結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-18 14:38:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 113 ms / 5,000 ms |
| コード長 | 944 bytes |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 99,456 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 15:34:15 |
| 合計ジャッジ時間 | 2,689 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
int main()
{
long long n;
cin >> n;
long long ansMin = LLONG_MAX;
long long ansMax = LLONG_MIN;
for(long long a=1; a*a*a<=n; ++a){
if(n % a != 0)
continue;
for(long long b=1; a*b*b<=n; ++b){
if(n % (a * b) != 0)
continue;
long long c = n / (a * b);
ansMin = min(ansMin, a + b + c - 3);
ansMax = max(ansMax, a + b + c - 3);
}
}
cout << ansMin << ' ' << ansMax << endl;
return 0;
}