結果
問題 |
No.376 立方体のN等分 (2)
|
ユーザー |
![]() |
提出日時 | 2016-06-04 23:28:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 508 ms / 5,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 1,601 ms |
コンパイル使用メモリ | 159,476 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 21:45:00 |
合計ジャッジ時間 | 7,032 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 38 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main(){ LL n; cin >> n; LL answer=n; for(LL a=46420;a>=1;--a){ if(n%a) continue; LL b; for(b=a;a*b*b<=n;++b); for(;b>=a;--b){ if(a+b+n/a/b-3>answer) break; if(n/a%b) continue; answer=min(answer,a+b+n/a/b-3); } } cout << answer << ' ' << n-1 << endl; return 0; }