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 1327. Fuses

Show all messages Hide all messages

Could anybody show me the formula? Endorphin 31 Oct 2011 13:11
I've got AC by stupid brute force, like if (i % 2) k++;.
But i think that there is a easier way to solve this task. Topic.
но это не тупой брутфорс, просто в четные дни он не ломает предохранители. 100-ый день четный, поэтому ответ 50, а не 51
Re: Could anybody show me the formula? Marin Tiberiu 6 Jul 2012 23:04
(B-(A/2*2+1)+2)/2
Re: Could anybody show me the formula? Artem Khizha [DNU] 7 Jul 2012 14:45
Seriously, guys, put away correct formulas, please.
Re: Could anybody show me the formula? Alexander 14 Oct 2012 16:22
If ((last day) mod 2 = 0) than formula = ((b - a)+1)/2
else formula = ((b - a) + 2) / 2
I got AC
Because if we our seconf day mod = 0, it means, that we mustn't count last day, only add 1. If our second day mod 2 = 1, it means, that we must count second day, add 2.
That's easy

Edited by author 14.10.2012 16:23

Edited by author 14.10.2012 16:24