POJ 2926 Requirements

这个。乱搞。

#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

POJ 2926 Requirements的相关文章

POJ——T2271 Guardian of Decency

http://poj.org/problem?id=2771 Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 5932   Accepted: 2463 Description Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he is

poj 1113 凸包周长

Wall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 33888   Accepted: 11544 Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he w

[2016-01-27][POJ][2230][Watchcow]

H - 欧拉图 中级者向 Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2230 Description Bessie's been appointed the new watch-cow for the farm. Every night, it's her job to walk across the farm and make s

poj 1113 Wall(标准的凸包果题)

题目链接:http://poj.org/problem?id=1113 Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build

poj——2771 Guardian of Decency

poj——2771    Guardian of Decency Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 5916   Accepted: 2458 Description Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he i

poj 2771 Guardian of Decency

Guardian of Decency http://poj.org/problem?id=2771 Time Limit: 3000MS   Memory Limit: 65536K       Description Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he is afraid that som

【POJ】1113 Wall(凸包)

http://poj.org/problem?id=1113 答案是凸包周长+半径为l的圆的周长... 证明?这是个坑.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorithm> #include <queue> #include <set>

OpenJudg / Poj 1363 Rails

1.链接: http://poj.org/problem?id=1363 http://bailian.openjudge.cn/practice/1363 2.题目: Rails Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24612   Accepted: 9644 Description There is a famous railway station in PopPush City. Country ther

poj 2771 Guardian of Decency【最大点独立集】

K - Guardian of Decency Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2771 Appoint description:  System Crawler  (2014-08-17) Description Frank N. Stein is a very conservative high-school teac