SRM145 DIV2 250

一般编程题,但是题目的叙述方式真的好奇怪

 1 class ImageDithering:
 2     def count(self, dithered, screen):
 3         counter = 0
 4         for line in screen:
 5             for ch in line:
 6                 if ch in dithered:
 7                     counter += 1
 8         return counter
 9 
10 
11 # test
12 o = ImageDithering()
13 
14 # test case
15 assert(o.count('BW', ("AAAAAAAA",
16  "ABWBWBWA",
17  "AWBWBWBA",
18  "ABWBWBWA",
19  "AWBWBWBA",
20  "AAAAAAAA")) == 24)
View Code
posted @ 2013-11-25 05:58  valaxy  阅读(137)  评论(0编辑  收藏  举报