Http://www.pythonchallenge.com/pc/return/italy.html
<!--remember:100*100 = (100+99+99+98) + (... -
③ page There is a wire.png picture, parsing the image of the pixel is not 1*10000
analysis test instructions, press 2 to decompose the picture in 3, and then press a picture meaning, rotate it to save in the picture ... such as: The 100th pixel, placed on the top row, 第100-199 on the rightmost column ...
solving process:
From PIL import image# the second picture given on the page wire.png is a 10000*1 picture, is to change to a 100*100 diagram, # Change the way and bread, around the circle, for example, first to the right to walk 100 steps, and then walk down 99 steps, # Then walk 99 steps to the left and walk up 98 steps, so that a lap is complete. Path = U './other/wire.png ' img = image.open (path) imnew=image.new (' RGB ', (100,100), color= (255,255,255)) #imnew. Show () num = 100a = 100counta = 0for I in range: if a > 0:b = c = A-1 D = a-2 #listaa = [A, b , C,d] #crop参数为 (left, upper, right, lower #a Boxa = (counta,0,counta+a,1) Re, upper and lower coordinates (not including lower right)) Gion=img.crop (Boxa) imnew.paste (region, (I, i)) #b Boxb = (counta+a,0,counta+a+b,1) region=img . Crop (boxb) region = Region.transpose (image.rotate_270) imnew.paste (region, (100-i-1,i+1)) #d Boxc = (counta+a+b,0,counta+a+b+c,1) region=img.crop (boxc) region = Region.transpose (image.rotate_180) Imnew.paste (region, (I, 100-i-1)) #d Boxd = (counta+a+b+c,0,counta+a+b+c+d,1) region=img.crop (BOXD) Region = RegiOn.transpose (image.rotate_90) imnew.paste (region, (I, i+1)) CountA = Counta+a + B + C + d A = A-2im New.show ()
Answer: Cat
The process of using Python 3.x to pythonchallenge-----14