码迷,mamicode.com
首页 > Windows程序 > 详细

UVa 10963 - The Swallowing Ground

时间:2015-02-06 20:35:05      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:

题目:给你两个轮廓,判断两个是否能完美的拼接,图形有小方块组成,轮廓用相邻列的方块高度表示。

分析:简单题。直接判断是不是所有对应位置的方块高度差相同即可。

说明:又是很久没刷题了,(⊙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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!