結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
|
提出日時 | 2020-02-27 14:45:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 104 ms / 5,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 1,642 ms |
コンパイル使用メモリ | 169,624 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 15:55:58 |
合計ジャッジ時間 | 2,688 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n;cin >> n; vector<ll> v; for(ll i=1;i*i*i<=n;i++){ if(n%i==0){ v.push_back(i); if(i*i!=n){ v.push_back(n/i); } } } ll p=1e12; int t=v.size(); for(int i=0;i<t;i++){ ll num=n/v[i]; for(ll j=1;j*j<=num;j++){ if(num%j==0){ p=min(p,v[i]+j+num/j-3); } } } cout << p << " " << n-1 << endl; }