結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-04-05 19:44:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 947 bytes |
| コンパイル時間 | 2,531 ms |
| コンパイル使用メモリ | 198,120 KB |
| 最終ジャッジ日時 | 2025-01-09 14:22:33 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 1 RE * 27 |
ソースコード
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
void cmn(lint&x,lint y){if(x>y)x=y;}
void cmx(lint&x,lint y){if(x<y)x=y;}
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint n;std::cin>>n;
std::vector<lint>div;
for(lint i=1;i*i<=n;i++){
if(n%i)continue;
div.push_back(i);
if(i*i!=n)div.push_back(n/i);
}
std::sort(ALL(div));
lint min=n,max=0;
int sz=div.size();
for(lint i=0;i<sz;i++){
lint x=div.at(i);
if(n<x*x*x)continue;
for(lint j=i;j<sz;j++){
lint y=div.at(j);
if(n<x*y*y)continue;
lint z=n/(x*y);
assert(x<=y&&y<=z);
lint now=x+y+z-3;
cmn(min,now);
cmx(max,now);
}
}
std::cout<<min<<' '<<max<<'\n';
}
ngtkana