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 kizuki at 2013-03-09 12:16:36 on Problem 3083
设左上右下为 0, 1, 2, 3
顺时针时,假设当前的前进方向为d, 那么从(d+2)%4,也就是相反方向开始循环,每次
(d+1)%4,遇到第一个能走的就前进。
逆时针时同理,不同的是每次(d-1+4)%4.

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