Maggu and Triangles
below given python code for iitwpc4b spoj or Maggu and Triangles spoj.just read Alcuin's sequence.
import sys t=int(sys.stdin.readline()) while t: n=int(sys.stdin.readline()) if n%2==0: k=n*n if k%48>24: result= k/48 + 1 else: result= k/48 else: k=(n+3)*(n+3) if k%48>24: result= k/48 + 1 else: result= k/48 sys.stdout.write(str(result)) sys.stdout.write("\n") t=t-1
No comments:
Post a Comment
Your comment is valuable to us