2018 Multi-University Training Contest 1
Posted qywhy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2018 Multi-University Training Contest 1相关的知识,希望对你有一定的参考价值。
1001:题面
题意:给定一个数n,找出三个正整数x、y和z,满足:n=x+y+z,x|n,y|n,z|n。然后求xyz的最大值。
题解:1=1/2+3/1+1/6=1/3+1/3+1/3=1/2+1/4+1/4 所以就三种
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 int main() { 5 int T; 6 scanf("%d", &T); 7 while(T--) { 8 LL n; 9 scanf("%lld", &n); 10 if(n % 3 == 0) { 11 LL ans = n / 3; 12 ans = ans * ans * ans; 13 printf("%lld ", ans); 14 } 15 else if(n % 4 == 0) { 16 LL a = n / 4; 17 LL b = n / 2; 18 LL ans = a * a * b; 19 printf("%lld ", ans); 20 } 21 else puts("-1"); 22 } 23 return 0; 24 }
1003:题面
题意:给出3*N个点,让你输出N个三角形使得他们互不相交, 题目输出保证不会有三点共线。
题解:因为不会有三点共线的情况,所以直接按x排序,直接输出即可
1 #include <bits/stdc++.h> 2 #define N 5005 3 using namespace std; 4 struct Node { 5 int x,y,index; 6 } node[N]; 7 bool cmp(Node a, Node b) 8 { 9 if(a.x == b.x) return a.y < b.y; 10 return a.x < b.x; 11 } 12 int main() 13 { 14 int T; 15 scanf("%d", &T); 16 while(T--) 17 { 18 int n; 19 scanf("%d", &n); 20 for(int i = 1; i <= 3 * n; ++i) 21 { 22 scanf("%d%d", &node[i].x, &node[i].y); 23 node[i].index = i; 24 } 25 sort(node + 1, node + 1 + 3 * n, cmp); 26 for(int i = 1; i <= 3 * n; i += 3) 27 printf("%d %d %d ", node[i].index, node[i + 1].index, node[i + 2].index); 28 } 29 return 0; 30 }
以上是关于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