Problem Description
Loading...
Problem Analysis
Because pow loses precision,
I used repeated multiplication instead.
For the maximum value,
since res may overflow __int64,
the termination condition only needs to be written before res is multiplied:res>r/k
which is equivalent to writing at the start of the loopres>r (because res=res*k has already been executed at that point)
cpp
| |
Problem link: 【CodeForces】[614A]Link/Cut Tree