Блог пользователя blankSpace

Автор blankSpace, 10 лет назад, По-английски

Hi, I was trying to solve 352C - Джефф и округления. My solution is 6873811. It's giving output as '0.000' in CF, even in Ideone.com, But in CodeBlocks IDE, it's giving correct answer '0.250'. Please help. What is the problem?

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

You are using both iostream and cstdio to handle input and output, remove line with ios::sync_with_stdio(0); and everything should be ok (I tried this on ideone.com and it wrote 0.250).

By the way you shouldn't call a function inside Abs, because for example Abs(solve(n+1,f+1) + ar[n]) will be translated to ((solve(n+1,f+1) + ar[n]) > 0? solve(n+1,f+1) + ar[n] : -(solve(n+1,f+1) + ar[n])) so function solve will be called twice, just saying, sometimes it can increase complexity a lot.