1 / 4
Feb 2019

#TRICOUNT - Counting Triangles
t=int(input())
for t in range(t):

n = int(input())

if(n%2==0):
    count= int((n*(n+2)*(2*n+1)/8))
    print(count)

else:
    count=int((((n*(n+2))*(2*n+1))-1)/8)
    print(count)

“”" why WA anyone “”"

thank you

  • created

    Feb '19
  • last reply

    Feb '19
  • 3

    replies

  • 893

    views

  • 2

    users

I’m not too familiar with Python, but it smells like a rounding error.