You are viewing a single comment's thread. Return to all comments →
my python solution
count=False for _ in range(int(input())): n=int(input())-1 i=1 array=[] while n!=0: a=n%i n=n//i # print(n,i,a) array.insert(0,a) i=i+1 arraychar=['a','b','c','d','e','f','g','h','i','j','k','l','m'] if len(array)<len(arraychar): for _ in range(len(arraychar)-len(array)): array.insert(0,0) newarray=[] for i in array: newarray.append(arraychar[i]) arraychar.pop(i) if count: print("") for i in newarray: print(i,end="") count=True
Project Euler #24: Lexicographic permutations
You are viewing a single comment's thread. Return to all comments →
my python solution