結果
問題 | No.375 立方体のN等分 (1) |
ユーザー |
![]() |
提出日時 | 2020-04-05 19:47:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 2,181 ms |
コンパイル使用メモリ | 199,316 KB |
最終ジャッジ日時 | 2025-01-09 14:23:00 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 24 RE * 1 |
ソースコード
#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); lint z=n/(x*y); if(z<=y)continue; assert(x<=y&&y<=z); lint now=x+y+z-3; cmn(min,now); cmx(max,now); } } std::cout<<min<<' '<<max<<'\n'; }