https://ctf.cpaw.site/questions.php?qnum=14 It is a memo to solve Q14 of Cpaw CTF in Python
It seems that the array is sorted in descending order I want to write it in Python because it's a big deal If you write the result first, it looks like this
list = [15,1,93,52,66,31,87,0,42,77,46,24,99,10,19,36,27,4,58,76,2,81,50,102,33,94,20,14,80,82,49,41,12,143,121,7,111,100,60,55,108,34,150,103,109,130,25,54,57,159,136,110,3,167,119,72,18,151,105,171,160,144,85,201,193,188,190,146,210,211,63,207]
sort_list = sorted(list, reverse=True)
answer = ''.join(map(str,sort_list))
print(answer)
First join
answer = ''.join(sort_list)
I got the following error
TypeError: sequence item 0: expected str instance, int found
It seems that join must be str type, and it seems that you can convert the type with map () as shown below, so when I tried it, I stopped throwing an error
answer = ''.join(map(str,sort_list))
If you look it up, it might be easier, but I solved it for the time being, so I'll leave it as a memo (´ ・ ω ・ `)
Recommended Posts