This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
* Official Solution
*
* Generous Butcher
* William Gozali
*/
#include <cstdio>
#define LL long long
using namespace std;
LL A, B, K1, K2;
LL pouw(LL a, LL b, LL c){
if (b == 0) return 1;
if (b & 1) return (a * pouw(a,b-1,c)) % c;
LL t = pouw(a, b/2, c);
return (t * t) % c;
}
int main()
{
scanf("%lld %lld %lld %lld", &A, &B, &K1, &K2);
A %= B;
for (LL i = K1; i <= K2; i++){
LL x = (A * pouw(10, i-1, B)) % B;
printf("%lld", (x*10)/B);
}
printf("\n");
}
# | 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... |