算法是比较低效的.仅仅是为了练习Python. #-*- coding:gb2312 -*- """北大ACM 1001 exponentiation 基本思路: 1.3099*12 去掉小数点后倒序得到[9,9,0,3,1] [9,9,3,0,1] * [9,9,0,3,1] = [9,9,0,3,1]*9*10^0 = [81, 81, 0,27, 9] + [9,9,0,3,1]*9*10^1 + [810, 810, 0,270, 90] + [9,9,0,3,1]*0*10^2 + [0, 0, 0,0, 0] + [9,9,0,3,1]*3*10^3 + [27000,27000,0,9000, 3000] + [9,9,0,3,1]*1*10^4 + [90000,90000,0,30000,10000] = [117891,117891,0,39297,13099] = [1,129680(117891+11789),0,39297,13099] = [1,0,12968,39297,13099] = ... = [1,0,8,3,17158] = [1,0,8,3,8,1715] = ... = [1,0,8,3,8,5,1,7,1] 然后倒序即可 小数点位置计算方法: 1.3099**2 = 1.71583801,小数位数为4*2 0.999**2 = 0.9980