无耻的抄袭了结果,三组数,从每一组数中选取一个数组成正六边形的对边,总共会有27个正六边形,从27个小六边形中选取19个组成大六边形,求大六边形的最大值
#include<iostream>
#include<stdio.h>
#include<memory.h>
#include<stdlib.h>
using namespace std;
int t = ;
const int N = ;
int num[N][N];
int f(const void* i, const void* j)
{
int* ii = (int*) i;
int* jj = (int*) j;
return *ii > *jj;
}
int MAX = -;
int mark1[] = { , , };
int mark2[] = { , , };
int main()
{
cin >> t;
int k = ;
while (k <= t)
{
MAX = -;
memset(num, , sizeof(num));
for(int i = ; i < ; i++)
{
for(int j = ; j < ; j++)
cin >> num[i][j];
qsort(num[i], N, sizeof(int), f);
}
for(int i = -; i < N; i++)
{
int MAX2 = ;
for(int j = ; j < N; j++)
{
if(i == j)
{
for(int k = ; k < N; k++)
MAX2 += num[j][k] * mark1[k];
}
else
{
for(int k = ; k < N; k++)
MAX2 += num[j][k] * mark2[k];
}
}
if(MAX2 > MAX)
MAX = MAX2;
}
printf("Test #%d\n%d\n\n", k, MAX);
k++;
} return ;
}