Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341762
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:05:28

我真的不懂
Task
You are to write a program to do 2-dimensional pattern matching. You will be given a
pattern, which is a 5x5 bitmap, and we call it the standard pattern. E.g.,
0 0 1 1 0
0 0 1 1 0
0 0 1 1 1
0 1 1 0 0
1 1 0 0 0
Then a sequence of test patterns (which are also 5x5 bitmaps) will be given and your
program has to tell whether each of these test patterns matches the standard pattern. A
bitmap A matches another bitmap B if they agree on all coordinates, possibly after rotating A
by 90o, 180o or 270o degrees. E.g., the above bitmap matches the following bitmap (because
after rotating the above bitmap by 90o anti-clockwise, they are the same):
0 0 1 0 0
1 1 1 0 0
1 1 1 1 0
0 0 0 1 1
0 0 0 0 1
Program Requirements…
Your program should first input the standard pattern which is specified by 5 lines, each line
consisting of five 0/1’s. Then it should ask for the number of test patterns, say, n. After that,
it should input the n test patterns and output “yes” or “no” depending on whether the testpattern matches the standard pattern. More precisely, your program should input one test
pattern, output “yes” or “no”, and then input the next test pattern, output “yes” or “no” and
so on until all the n test patterns are processed. A sample test case is given in PASS. You
may assume n is always ³ 1 and that all the inputs are valid.

Sample Input
0 0 1 1 0
0 0 1 1 0
0 0 1 1 1
0 1 1 0 0
1 1 0 0 0
5
0 0 1 1 0
0 0 1 1 0
0 0 1 1 1
0 1 1 0 0
1 1 0 0 0
0 0 1 0 0
1 1 1 0 0
1 1 1 1 0
0 0 0 1 1
0 0 0 0 1
0 0 0 1 1
0 0 1 1 0
1 1 1 0 0
0 1 1 0 0
0 1 1 0 0
1 0 0 0 0
1 1 0 0 0
0 1 1 1 1
0 0 1 1 1
0 0 1 0 0
1 1 0 0 0
0 1 1 0 0
0 0 1 1 1
0 0 1 1 0
0 0 1 1 0

Sample Output
yes
yes
yes
yes
no

--------------------next---------------------

阅读(1023) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~