This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
long long pw(int a, int x, int m){
long long r = a, p = 10;
while (x) {
if(x&1) r *= p;
p *= p;
r %= (10ll * m);
p %= (10ll * m);
x >>= 1;
}
return r;
}
int main(){
int a,b,s,e;
scanf("%d %d %d %d",&a,&b,&s,&e);
long long t = pw(a,s,b);
for (int i=s; i<=e; i++) {
printf("%lld",t/b);
t %= b;
t *= 10;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |