firedrakesin's blog

By firedrakesin, history, 3 years ago, In English

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?

  • Vote: I like it
  • -3
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it
  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.