結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-18 14:32:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 5,000 ms |
| コード長 | 442 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 54,676 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 19:59:04 |
| 合計ジャッジ時間 | 2,266 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | i64 n; scanf("%lld", &n);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream>
using namespace std;
using i64 = long long;
constexpr i64 inf = 987654321987654321LL;
int main(void) {
i64 n; scanf("%lld", &n);
i64 mini = inf;
for(i64 a=1; a*a*a<=n; ++a) {
if(n % a != 0) { continue; }
i64 m = n / a;
for(i64 b=1; b*b<=m; ++b) {
if(m % b != 0) { continue; }
i64 c = m / b;
mini = min(mini, a + b + c - 3);
}
}
printf("%lld %lld\n", mini, n-1);
return 0;
}