Advertisement
roronoa

last digit n**p pow (pas de moi)

Nov 14th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4. # Auto-generated code below aims at helping you parse
  5. # the standard input according to the problem statement.
  6.  
  7. n = int(input())
  8. p = int(input())
  9.  
  10. # Write an action using print
  11. # To debug: print("Debug messages...", file=sys.stderr)
  12.  
  13. last = n%10
  14. for _ in range(p-1):
  15.     last = last*n%10
  16.     print(last, file=sys.stderr)
  17.  
  18. print(last)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement