Add MUTC 2017 Team 6

This commit is contained in:
Kirigaya Kazuto 2017-08-19 17:28:50 +08:00
parent a197ab75bd
commit f3c31d48a0
2 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <cstdlib>
#include <cstring>
using namespace std;
bool cmp(const pair<int, int> A, const pair<int, int> B) {
if (A.first == B.first) {
return A.second < B.second;
}
else
return A.first > B.first;
}
vector<pair<int, int>> a;
int main() {
int testcases;
cin >> testcases;
while (testcases--) {
a.clear();
int n;
cin >> n;
int temp;
for (int i = 1; i <= n; i++) {
cin >> temp;
a.push_back(make_pair(temp,i));
}
sort(a.begin(),a.end(),cmp);
for (int i = 2; i <= n; i++) {
for (int j = 0; j < n; j++) {
if (a[j].second%i == 0)
continue;
else {
cout << a[j].first;
break;
}
}
if (i != n)
cout << ' ';
}
cout << endl;
}
}

View File

@ -0,0 +1,39 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int maxtotal=-1;
for(int i=0;i<n;i++)
{
int a,b,c,ab,bc,ac,abc;
scanf("%d %d %d %d %d %d %d",&a,&b,&c,&ab,&bc,&ac,&abc);
int A,B,C,AB,BC,AC,ABC;
ABC=abc;
AB=ab-abc;
BC=bc-abc;
AC=ac-abc;
A=a-AB-AC-ABC;
B=b-AB-BC-ABC;
C=c-AC-BC-ABC;
if(A<0||B<0||C<0||AB<0||AC<0||BC<0||AC<0||ABC<0)
{
continue;
}
int total=A+B+C+AB+AC+BC+ABC;
maxtotal=max(total,maxtotal);
}
printf("%d\n",maxtotal);
}
return 0;
}