You are viewing a single comment's thread. Return to all comments →
why isn't this allowed?
for i in range (int(input())-1): print (int(format (2**(i+1)-1,'b'))*(i+1))
edit: ok this is dumb but i think its because of the 'for' in 'format'. Can the dev pls patch this?
if i use the following instead, it works: for i in range (int(input())-1): print (int(bin (2**(i+1)-1)[2:])*(i+1))
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Triangle Quest
You are viewing a single comment's thread. Return to all comments →
why isn't this allowed?
for i in range (int(input())-1): print (int(format (2**(i+1)-1,'b'))*(i+1))
edit: ok this is dumb but i think its because of the 'for' in 'format'. Can the dev pls patch this?
if i use the following instead, it works: for i in range (int(input())-1): print (int(bin (2**(i+1)-1)[2:])*(i+1))