标签:
题目:给你两个轮廓,判断两个是否能完美的拼接,图形有小方块组成,轮廓用相邻列的方块高度表示。
分析:简单题。直接判断是不是所有对应位置的方块高度差相同即可。
说明:又是很久没刷题了,(⊙v⊙)。
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int t,n,flag,a,b,s;
while (~scanf("%d",&t))
while (t --) {
scanf("%d",&n);
flag = 1;
if (n) {
scanf("%d%d",&a,&b);
s = a-b;
for (int i = 1 ; i < n ; ++ i) {
scanf("%d%d",&a,&b);
if (a-b != s)
flag = 0;
}
}
if (flag)
printf("yes\n");
else printf("no\n");
if (t) printf("\n");
}
return 0;
}
UVa 10963 - The Swallowing Ground
标签:
原文地址:http://blog.csdn.net/mobius_strip/article/details/43568173