2018 Multi-University Training Contest 1

A Maximum Multiple

给定一个数字n,找到三个n的因数 x y z ,满足 x + y + z = n。求 xyz 的最大值。

若n%3 == 0,则答案一定是 (n/3)^3。

若要把 n 分成两个数,则一定是 n/2 和 n/2。但是现在是三个数,所以要把其中一个 n/2 分成 n/4 和 n/4。所以要求n%4 == 0。

至于其他的为什么不行,我不会证明。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;

int main()
{
    int t;
    scanf("%d", &t);
    for (int ca = 1; ca <= t; ca++)
    {
        LL n;
        scanf("%lld", &n);
        if (n%3 == 0)
            printf("%lld
", (n/3)*(n/3)*(n/3));
        else if (n%4 == 0)
            printf("%lld
", (n/2)*(n/4)*(n/4));
        else printf("-1
");
    }
}


B Balanced Sequence

按照价指贪心。

https://www.cnblogs.com/ruthank/p/9371156.html


C Triangle Partition

直接按照一定次序排序、输出即可。


D Distinct Values

用set巧妙的维护一个区间。

https://www.cnblogs.com/ruthank/p/9362079.html


E Maximum Weighted Matching


F Period Sequence


G Chiaki Sequence Revisited


H RMQ Similar Sequence

笛卡尔树。

https://www.cnblogs.com/ruthank/p/9733501.html


I Lyndon Substring


J Turn Off The Light


K Time Zone

签到。精度坑人。

原文地址:https://www.cnblogs.com/ruthank/p/9806558.html