結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-06-04 23:38:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 145 ms / 5,000 ms |
| コード長 | 444 bytes |
| コンパイル時間 | 881 ms |
| コンパイル使用メモリ | 74,096 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 20:51:21 |
| 合計ジャッジ時間 | 2,510 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
long n;
cin>>n;
set<long> s;
long res=n-1;
for(long i=1; i*i<=n; ++i) {
if (n%i) continue;
auto m=n/i;
if (s.count(m)) continue;
s.insert(m);
for(long j=1; j*j<=m; ++j) {
if (m%j) continue;
res=min(res, i-1+j-1+m/j-1);
}
}
cout<<res<<' '<<n-1<<endl;
}
hogeover30