update
This commit is contained in:
parent
75727d77da
commit
576b97f16d
29
src/P1965/P1965.cpp
Normal file
29
src/P1965/P1965.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#define NV(v)#v<<" : "<<(v)
|
||||
using ull = unsigned long long;
|
||||
|
||||
static ull n, m, k, x;
|
||||
static auto &is = std::cin;
|
||||
static auto &os = std::cout;
|
||||
|
||||
template<class T>
|
||||
T fast_pow(T b,T e, const T &k){
|
||||
T ret{1};
|
||||
b%=k;
|
||||
while(e>0){
|
||||
if(e&1){
|
||||
ret = (ret * b)%k;
|
||||
}
|
||||
e>>=1;
|
||||
b = (b*b) %k;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(){
|
||||
// os<<NV(fast_pow(3,3, 1000))<<'\n';
|
||||
is>>n>>m>>k>>x;
|
||||
os<<((x+m*((ull)(fast_pow(10ull,k,n))%n))%n)<<'\n';
|
||||
}
|
Loading…
Reference in New Issue
Block a user