1 defMain ():2n =Int (raw_input ())3arr =map (int, raw_input (). Strip (). Split ())4 5 forIinchrange (n):6Cutnum =07MinValue =min (arr)8 for_inchrange (n):9 if0 < Arr[_] < 1001:TenArr[_]-=MinValue OneCutnum + = 1 A ifArr[_] <= 0:#to make an inappropriate value, a stripping cycle -Arr[_] = 1001 - ifCutnum! = 0:#two-layer loops are rich out, so only output is not 0, a dynamic adjustment of coding the PrintCutnum - -Main ()
Learn
Try
Operations such as pop
A new way of thinking
1n =Int (raw_input (). Strip ())2sticks = [Int (i) forIinchraw_input (). Strip (). Split ( )3 Sticks.sort ()4NewItem =Sticks[0]5Count =len (sticks)6 PrintCount7Count-= 18 forIinchRange (1, Len (sticks)):9 ifSticks[i]! =NewItem:TenNewItem =Sticks[i] One PrintCount ACount-= 1
Learn
The order is not important, it is possible to sort it out first.
Cut the Sticks