Give me some tips to solve- uva 10692 problem.. - problem link:https://uva.onlinejudge.org/external/106/10692.pdf
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | ecnerwala | 3715 |
| 3 | jiangly | 3664 |
| 4 | Kevin114514 | 3604 |
| 5 | ksun48 | 3599 |
| 6 | tourist | 3533 |
| 6 | VivaciousAubergine | 3533 |
| 8 | strapple | 3486 |
| 9 | dXqwq | 3436 |
| 10 | maroonrk | 3423 |
| # | User | Contrib. |
|---|---|---|
| 1 | Um_nik | 161 |
| 2 | Qingyu | 160 |
| 3 | adamant | 156 |
| 4 | Dominater069 | 152 |
| 5 | errorgorn | 150 |
| 6 | cry | 148 |
| 7 | Proof_by_QED | 144 |
| 8 | Arpa | 143 |
| 9 | TheScrasse | 142 |
| 10 | soullless | 141 |
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)