Wednesday 30 January 2013

7406. Beehive Numbers Problem code: BEENUMS

while 1:
    n=input()
    if n==-1:
        break
    k=float((-3+pow(-3+12*n,1.0/2))/6)
    d=int(k)
    if d-k==0:
        print "Y"
    else:
        print "N"   

No comments:

Post a Comment