CoreForces Round #102B Help Farmer

Posted vagrant-ac

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CoreForces Round #102B Help Farmer相关的知识,希望对你有一定的参考价值。

C. Help Farmer
简化题意:已知abc=N,给出N,求解出
[ (a+2)*(b+2)*(c+1) 的最大值和最小值 ]
题解:暴力枚举a,b,c,求出最小值。
默认
[ 最大值 =3*3*(N+1) ]

#include <cstdio>  
#include <queue>  
using namespace std;  
typedef long long ll;  
ll min(ll a,ll b){  
    return a<b?a:b;  
}  
ll max(ll a,ll b){  
    return a>b?a:b;  
}  
int main(){  
    ll N;  
    scanf("%lld",&N);  
    ll minn=3*3*(N+1);  
    for(ll a=1;a<=100000;a++){  
        if(N%a==0)  
        for(ll b=1;b<=10000;b++){  
            if(N%(a*b)==0){  
                ll c=N/a/b;  
                minn=min(minn,(min(min(a,b),c)+1)*(max(max(a,b),c)+2)*
                (a+b+c-min(min(a,b),c)-max(max(a,b),c)+2));  
            }  
        }  
    }  
    printf("%lld",minn-N);  
    printf(" %lld
",3*3*(N+1)-N);  
    return 0;  
}

以上是关于CoreForces Round #102B Help Farmer的主要内容,如果未能解决你的问题,请参考以下文章

CoreForces Round #104DLucky Number 2

Coreforces-1194D1-2-K Game

Educational Codeforces Round 102 E. Minimum Path(分层图最短路)

Educational Codeforces Round 102 E. Minimum Path(分层图最短路)

Codeforces Round #516 (Div. 1, by Moscow Team Olympiad) C

round分析