程序a | 程序b |
a = 2 res = 1 n = int(input()) for i in range(n): res = res * a print(res) | def powr(a, n): if n == 1: return a elif n == 0: return 1 else: tmp = powr(a, n // 2) return tmp * tmp a = 2 n = int(input()) print(powr(a, n)) |