Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

跳跃式编码的问题与解决

Posted by llcheng at 2018-04-16 20:58:51 on Problem 1009
所谓跳跃式编码,就只管开始出现像素变化的周围八个点。
但有如下BUG,看如下矩阵:
4  4  4  4
4  4  3  4
4  4  4  4
4  4  4  4
4  4  4  4
一般情况下回得到结果:
0  1  1  1
0  1  1  1
1  1  1  1
1  1  1  1
1  1  1  1
正确应该是:
0  1  1  1
0  1  1  1
0  1  1  1
0  0  0  0
0  0  0  0
相信大家很快看出了问题,在(3,1)位置的地方即周围八个像素(其实是5个)没有加以判断
因此做如下改进:
对于一个输入对pixel, length
如果它会导致跨行,则在第一次跨行的(行首)位置(如用例的(3,1)位置)及周围八个像素(其实是5个)添加判断。

这样就完美解决了问题<( ̄︶ ̄)↗

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator