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

Re:这个解法最清晰

Posted by blacksnow at 2007-07-17 16:55:47 on Problem 1013
In Reply To:这个解法最清晰 Posted by:SeedJYH at 2006-04-02 22:27:56
> 一个重量数组int W[256]
> 先把全部硬币重量赋值为1
> 遍历全部硬币
> {
> 每次把其中一个硬币重量赋值为2,检查3个表达式是否出现矛盾,如果没有矛盾就找到解了,break
> 再把同一个硬币重量赋值为0,检查3个表达式是否出现矛盾,如果没有矛盾就找到解了,break
> 再把同一个硬币重量恢复1,检查下一个
> }
> 所谓矛盾,只要把表达式两边硬币重量加起来比较看看是不是和even、up、down一致
> 
> 现在下标对应的就是假币
> 而这个下标对应的W[]值说明了它是heavy(为2时)或是light(为0时)
> 
> 简单吧?

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