Forezz

ДЗ 9 Н 4

Jul 25th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. # _*_ coding: utf-8 _*_
  2. def quick(qstepen, i):
  3.     if id == 1:
  4.         if i < n:  
  5.             qstepen *= (a*a)
  6.             quick(qstepen, i + 1)
  7.         else:
  8.             print (qstepen)  
  9.     elif id == 2:
  10.         if i < n:
  11.             qstepen *= a
  12.             quick(qstepen,  i + 1)
  13.         else:
  14.             print (qstepen * a)
  15.            
  16.        
  17. a = int(input())    
  18. n = int(input())
  19. i = 1
  20. if n % 2 == 0:
  21.     n //= 2
  22.     qstepen = (a*a)
  23.     id = 1
  24. elif n % 2 == 1:
  25.     n -= 1
  26.     qstepen = a
  27.     id = 2
  28. quick(qstepen, i)
Advertisement
Add Comment
Please, Sign In to add comment