| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Ants 1852 为什么会Runtime Error啊#include <iostream>
using namespace std;
int x;
pair<int,int> ant[100];
int sumn[100][100];
int main()
{
scanf("%d",&x);
for(int i=0;i<x;i++)
{
scanf("%d",&ant[i].first);
scanf("%d",&ant[i].second);
for(int j=0;j<ant[i].second;j++)
{
scanf("%d",&sumn[i][j]);
}
}
for(int i=0;i<x;i++)
{
int tmin=0,tmax=0;
for(int j=0;j<ant[i].second;j++)
{
if(sumn[i][j]<(ant[i].first/2))
{
tmin=max(sumn[i][j],tmin);
tmax=max(tmax,ant[i].first-sumn[i][j]);
}
else
{
tmin=max(tmin,ant[i].first-sumn[i][j]);
tmax=max(tmax,sumn[i][j]);
}
}
printf("%d %d\n",tmin,tmax);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator