|
|
вернуться в форумCould anybody show me the formula? 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. Re: Could anybody show me the formula? Послано JDBaha 3 июл 2012 15:45 но это не тупой брутфорс, просто в четные дни он не ломает предохранители. 100-ый день четный, поэтому ответ 50, а не 51 Re: Could anybody show me the formula? (B-(A/2*2+1)+2)/2 Re: Could anybody show me the formula? Seriously, guys, put away correct formulas, please. Re: Could anybody show me the formula? 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 |
|
|