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 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 142 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
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)