Give me some tips to solve- uva 10692 problem.. - problem link:https://uva.onlinejudge.org/external/106/10692.pdf
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
Give me some tips to solve- uva 10692 problem.. - problem link:https://uva.onlinejudge.org/external/106/10692.pdf
| Name |
|---|



A ^ x % m = A ^ (x % phi [M] + phi [M]) % m (x >= phi [M])(phi [M] M is the Euler function)you can recursively go to solution.
Why do we need to sum up
phi[M]inA ^ (x % phi [M] + phi [M]) % m? Isn'tA ^ (x % phi[M]) % mgood enough?In case
x % φ[M]is equal to0,A^0 % Mwill become one, which may not be same asA^φ{M} % Me.g. (2 ^ 0) % 10 = 1, (2 ^ 4) % 10 = 6, phi[10] = 4;
Thanks.. if u explain How/Why its works?
it is necessary to dfs like that
Can you or someone else please reply why this equation works? Is this true for any A and m ?
Here's the AC code may help you, be careful that we should test if b in ab is greater than φ(m)