ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1025. Democracy in Danger

Where different?
Posted by Mirrus 9 Jun 2006 18:35
Where different in Pascal
1) round(k/2)
and
2) (k+1) div 2

with 1) - WA#1
with 2) - AC

Edited by author 09.06.2006 18:41

Edited by author 09.06.2006 18:41

Edited by author 09.06.2006 18:41
Re: Where different?
Posted by ILYA 22 Jun 2006 18:33
probably, not round(k/2), but trunc(k/2)
Re: Where different?
Posted by Alexey 22 Jun 2006 18:51
No, not trunc(k/2).
For example, if k=5,
round(k/2)=2
(k+1) div 2=3.

Edited by author 23.06.2006 13:22
Re: Where different?
Posted by Cemil 14 Feb 2007 22:05
Why (k+1) div 2 ??
Write (k) div 2 and it'll be ok.
Re: Where different?
Posted by Dribas Vlad(Kherson State University) 29 Nov 2009 04:13
I wrote
g:=g + (a[i] div 2 + 1)
because we have to take more than half.
For example : if a[i] = 5 then majority will be 3,
and 3 we can get only using this expression
g:=g + (a[i] div 2 + 1)