1 + 11 + 1111+ 11111+ ..... + 11111(2016个) 结果是几位数
# -*- coding: utf-8 -*- """ Created on Mon Mar 21 20:38:06 2016 @author: yanjie """ ''' 1 + 11 + 1111+ 11111+ ..... + 11111(2016个) 结果是几位数 用什么数据结构 有几个6 写算法 ''' a = []; m = 0; six = 0; for i in range(2016,0,-1): b = (i+m) % 10; m = (i+m) / 10; a.append(b) if b==6: six = six + 1; if m>0: a.append(m) print len(a) #2016 print six #226 print 'hello' ''' c = reversed(a) for i in list(c): print i,; '''