結果
問題 | No.376 立方体のN等分 (2) |
ユーザー |
|
提出日時 | 2016-07-18 14:38:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4,823 ms / 5,000 ms |
コード長 | 944 bytes |
コンパイル時間 | 887 ms |
コンパイル使用メモリ | 99,412 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 15:35:13 |
合計ジャッジ時間 | 31,195 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 38 |
ソースコード
#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; }