Simple Math ARC111 - A 数论,思维
题意
给出(N,M),求(lfloorfrac{10^N}{M} floor)除以(M)的余数
[1leq N leq 10^{18}\
1leq M leq 10000
]
分析
(lfloorfrac{10^N}{M} floor equiv lfloorfrac{10^N}{M} floor - kM equiv lfloorfrac{10^N - kM^2}{M} floor (mod M))
于是先求分子即可
代码
int main(){
ll n = rd();
ll m = rd();
cout << ksm(10,n,m * m) / m;
}