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 litkit at 2010-11-01 21:37:55 on Problem 1507
(空格为n*n*n)
对于一个n数码 形成一个序列 {1,2,3,4...n*n*n}
若该序列的逆序对为a;
定义dist为:空格的位置与终止转状态的哈密顿距离b=|x1-x2|+|y1-y2|+|z1-z2|;
若cnt=a+b为偶数则有解否则则无解
  if(cnt % 2 == 0) puts("Puzzle can be solved.");
        else puts("Puzzle is unsolvable.");

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