結果
問題 | No.375 立方体のN等分 (1) |
ユーザー |
|
提出日時 | 2024-10-11 20:56:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 374 bytes |
コンパイル時間 | 1,566 ms |
コンパイル使用メモリ | 165,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 20:56:32 |
合計ジャッジ時間 | 3,204 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
# include <bits/stdc++.h>using namespace std;typedef long long ll;ll n, mn;int main(){scanf("%lld", &n);mn = n - 1;for (ll i = sqrt(n) + 1, x; i >= 1; i--){if (n % i == 0){x = n / i;for (ll j = sqrt(x) + 1; j >= 1; j--){if (x % j == 0) mn = min(mn, i - 1 + j - 1 + x / j - 1);}}}printf("%lld %lld\n", mn, n - 1);return 0;}