2018杭电多校第一场(A)

题意:x+y+z = n , n%x=0,n%y=0,n%z=0,求x*y*z 的最大值

题解:

 

ac code:

#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        ll n;
        scanf("%lld",&n);
        n = n*n*n;
        if(n%27 == 0)
            printf("%lld\n",n/27);
        else if(n%32 == 0)
            printf("%lld\n",n/32);
        else if(n%36 == 0)
            printf("%lld\n",n/36);
        else
            printf("-1\n");
    }
    re

 

posted @ 2018-07-23 20:51  jadelemon  阅读(304)  评论(1编辑  收藏  举报