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 wyc4662 at 2011-09-12 12:01:22 on Problem 1029
因为只有一个假币,所有的不等式都是由假币造成的,因此每一个不等式中假币都会出现
而且,这颗假币会固定集中在不等式的小号端或者大号端
因此,我们可以开一个数组f,对于每一个不等式
使大号端的所有硬币f[i]=f[i]+1
使小号端的所有硬币f[i]=f[i]-1
顺带记录不等式的个数m
很明显,只有abs(f[i])=m并且从未出现在等式里的或者根本没出现过的是嫌疑犯
如果所有出现过的硬币f[i]都是0,那么假币就是从未出现过的硬币
如果有多个abs(f[i])=m,则输出0
16ms~

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