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

Автор firedrakesin, история, 3 года назад, По-английски

This is the code I wrote for the problem 'Calculating Function'

g=int(input()) if g%2==0: n=g/2 print(int((n*(n+1))-(n*n))) else: n=g//2; c=n+1 print(int((n*(n+1))-(c*c)))

It is correct but when I submitted it, it is showing wrong answer on test case 5. So I asked my friend and he did submit my code on codeforces from his account and it got accepted on his account. Why so?

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
  1. Don't you see that this (and your latter post) too hard to read without swearing?
  2. n = g / 2. In Python n would be float pointing number which have not nessecary precision, so you got WA.
  3. Don't know how exactly same code could get AC. Mind to share.