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

AC,一个比较naive的方法

Posted by fujima at 2011-11-15 10:35:05 on Problem 1029
1.用一个数组来对应所有硬币,每个硬币初始值都是-2。
2.每次weigh之后,如果不是=号,就把所有其他硬币值设为0(它们已肯定是真币),对于被称的硬币,按下列规则更改: 假设-1表示硬币轻,1表示硬币重,0表示相等,*表示任何情况,括号内左边的数字为硬币weigh之前的值,右边的数为weigh的结果,-〉后面的数为硬币weigh之后的值:
(0,*) -〉0
(*,0) -〉0
(-2,*) -〉*
(-1,-1)-〉-1
(1,1)-〉1
(-1,1)-〉0
(1,-1)-〉0
3.检查数组内0的个数,即已经确认的真币的个数,如果是N-1,则结束,否则继续下一次weigh

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