Advertisement
ccbeginner

ZJ a010

Mar 29th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. #zj a010 in python
  2.  
  3. while True:
  4.     try:
  5.         num = int(input())
  6.         m = 2
  7.         while True:
  8.             if num % m == 0:
  9.                 num = num // m
  10.                 print(m, end='')
  11.                
  12.                 index = 1
  13.                 while num % m == 0:
  14.                     num = num // m
  15.                     index += 1
  16.                 if index != 1:
  17.                     print('^', index, sep='', end='')
  18.                 if num != 1:
  19.                     print(' * ', end='')
  20.             m += 1
  21.                
  22.            
  23.             if num == 1:
  24.                 print()
  25.                 break
  26.            
  27.     except EOFError:
  28.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement