結果
問題 | No.376 立方体のN等分 (2) |
ユーザー |
|
提出日時 | 2022-06-28 21:43:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 2,065 ms |
コンパイル使用メモリ | 195,584 KB |
最終ジャッジ日時 | 2025-01-30 01:30:07 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 WA * 5 TLE * 3 |
ソースコード
#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; }