2018 Multi-University Training Contest 1

Posted emcikem

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2018 Multi-University Training Contest 1相关的知识,希望对你有一定的参考价值。

A打表找规律

//输入一个n,找到3个数x,y,z使得x+y+z=n,可以整除n,以及xyz最大,且输出xyz
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define INF 0x3f3f3f3f
using namespace std;
const int maxn=1e6+5;
int maxx=-1;
void solve(int n)
    for(int x=1;x<=n;x++)
        for(int y=1;y<=n;y++)
            int z=n-x-y;
            if(z<=0)break;
            if(n%x==0&&n%y==0&&n%z==0)
                int zz=x*y*z;
                maxx=max(maxx,zz);
            
        
    
    printf("%4d ",maxx);
    if(n%10==0)putchar('\n');

int main()
    // int t;
    // scanf("%d",&t);
    // while(t--)
        int n;
        scanf("%d",&n);
        int flag=1;
        for(int i=1;i<=n;i++)
            maxx=-1;
            solve(i);
        
    // 
    return 0;

/*
20
  -1   -1    1    2   -1    8   -1   16   27   -1
  -1   64   -1   -1  125  128   -1  216   -1  250
3的倍数
3  1
6  8
9  27
12 64
15 125
18 216


4的倍数
4  2
8  16
12 64
16 128
20 250
*/

以上是关于2018 Multi-University Training Contest 1的主要内容,如果未能解决你的问题,请参考以下文章

2018 Multi-University Training Contest 2

2018 Multi-University Training Contest 9

2018 Multi-University Training Contest 4

2018 Multi-University Training Contest 4

2018 Multi-University Training Contest 3

2018 Multi-University Training Contest 8