这个。乱搞。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define maxn 100005
using namespace std;
int n,inf=99999999;
double dot[maxn][5];
double maxm[35],minm[35];
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
for (int j=1;j<=5;j++)
scanf("%lf",&dot[i][j]);
}
for (int i=0;i<=32;i++)
{
maxm[i]=-inf;
minm[i]=inf;
}
int tmp=1<<5;
for (int i=1;i<=n;i++)
{
for (int j=0;j<tmp;j++)
{
int t=j;double ans=0;
for (int k=1;k<=5;k++)
{
if (t&1) ans=ans+dot[i][k];
else ans=ans-dot[i][k];
t=t>>1;
}
if (maxm[j]<ans) maxm[j]=ans;
if (minm[j]>ans) minm[j]=ans;
}
}
double ans=-inf;
for (int i=0;i<tmp;i++)
{
if (maxm[i]-minm[i]>ans)
ans=maxm[i]-minm[i];
}
printf("%.2lf",ans);
return 0;
}
时间: 2024-11-08 18:58:55