Computer Programming Contest Preparation

ToolBox - Source for: 12/1243/hint.txt



/home/toolbox/public_html/solutions/12/1243/hint.txt
    1 2
    2 4
    3 8
    4 16 3
    5 6
    6 12
    7 24 11
    8 22 9
    9 18 5
   10 10
   11 20 7
   12 14 1
   13 2
   14 
   15 2147483647 165191049 178956970
   16 
   17 z = x^y mod n
   18 
   19 cnt = y % (n-1)
   20 
   21 fin = x
   22 for (i=0; cnt>i; i++)
   23  fin = (fin * x) % n
   24 
   25  93 40 33
   26  cnt = 40 % (33 - 1) = 8
   27 
   28  93
   29  8649 3
   30  279 15
   31  1395 9
   32  837 12
   33  1116 27
   34  2511 3
   35  279 15
   36  1395 9
   37  837 12
   38  1116 27
   39 
   40  93 27
   41  2511 3