Number Theory Problem from UVA (UVA 11774 — Doom’s Day)

Revision en1, by Tobby_And_Friends, 2017-01-11 15:47:41

Link: https://uva.onlinejudge.org/external/117/11774.pdf

I understand that the for n == m answer is 2. But I can't figure out the solution when n != m. I mean I basically do not understand the theory behind the solution (apart from trying out for small test cases). Any help is really appreciated.

Tags number theory, uva

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Tobby_And_Friends 2017-01-11 15:47:41 355 Initial revision (published)