| ||||||||||
| 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 | |||||||||
Re:帮帮我看看In Reply To:Re:帮帮我看看 Posted by:ync at 2004-10-26 19:11:16 你那个不对是因为
测这个
5 2
1 5
2 5
那我这个不对,为什么啊
#include"stdio.h"
main()
{
int n,p,x,y,i,j,min,max;
int barn[1000];
while(scanf("%d%d",&n,&p)!=EOF)
{
for(i=0;i<1000;i++)
barn[i]=0;
for(j=0;j<p;j++)
{
scanf("%d%d",&x,&y);
max=x;min=y;
if(max<min)
{max=y;min=x;}
if(max-min>min+n-max)
{
for(i=max;i<min+n;i++)
barn[i%n]=1;
}
else
{
for(i=min;i<max;i++)
barn[i%n]=1;
}
}
j=0;
for(i=0;i<1000;i++)
if(barn[i]==1)
j++;
printf("%d\n",j);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator