本站遷移

因為我最近租用了網路空間以及網域,
故本站已遷移至新網站~
這邊的資訊已經正在進行搬移的工作~
希望各位可以到新網站去逛XD

New Website:
http://knightzone.org/

搜尋此網誌

2011年3月14日 星期一

[UVa]10963:The Swallowing Ground

直接檢查每個y的裂痕是否相等即可得解。

[C](0.016)
#include<stdio.h>
int main()
{
int N;
int print = 0;
while( scanf( "%d", &N ) != EOF )
{
int i;
for( i = 0 ; i < N ; i++ )
{
if( print )
printf( "\n" );
print = 1;
int W;
scanf( "%d", &W );
int y1, y2;
int ok = 1;
scanf( "%d%d", &y1, &y2 );
int gap = y1-y2;
int j;
for( j = 1 ; j < W ; j++ )
{
scanf( "%d%d", &y1, &y2 );
if( y1-y2 != gap )
ok = 0;
}
if( ok )
printf( "yes\n" );
else
printf( "no\n" );
}
}
return 0;
}
view raw UVa10963.c hosted with ❤ by GitHub

0 意見:

張貼留言