Guest User

Untitled

a guest
Oct 22nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. f = open("input.txt", "r")
  2. z = open("output.txt", "w+")
  3. F = f.read()
  4. A, N = map(int, F.split())
  5. B = 0
  6. с = 0
  7. for B in range(10**9):
  8. if (A * B + A + B) % N == 0:
  9. с = 1
  10. break
  11. if c != 1:
  12. B = -1
  13. z.write(str(B))
  14. f.close()
  15. z.close()
Add Comment
Please, Sign In to add comment