Skip to content

Instantly share code, notes, and snippets.

@anmolj7
Created January 18, 2020 14:06
Show Gist options
  • Save anmolj7/ea451e6b16a448f120f76e7afd4bab28 to your computer and use it in GitHub Desktop.
Save anmolj7/ea451e6b16a448f120f76e7afd4bab28 to your computer and use it in GitHub Desktop.
from math import sqrt, floor
T = int(input())
for _ in range(T):
power = int(input())
k = -0.5+sqrt(1+2*power)/2
if k == floor(k):
k -= 1
k = floor(k)
sum_bef = (k*(4+4*k))/2
bw = 4+k*4
if sum_bef <= power and power <= sum_bef+bw/2:
print('IRON MAN')
else:
print('CAPTAIN AMERICA')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment