Submission #13730

#TimeUsernameProblemLanguageResultExecution timeMemory
13730gs14004관대한 주인 (TOKI14_generous)C++14
65 / 100
9 ms1084 KiB
#include <cstdio> long long mul(long long a, long long b, long long m){ long long ret = 0; while (b) { if(b&1) ret += a; b >>= 1; a <<= 1; ret %= m; a %= m; } return ret; } long long pw(int a, int x, int m){ long long r = a, p = 10; while (x) { if(x&1) r = mul(r,p,m*10); p = mul(p,p,m*10); x >>= 1; } return r; } int main(){ int a,b,s,e; scanf("%d %d %d %d",&a,&b,&s,&e); a %= b; long long t = pw(a,s,b); for (int i=s; i<=e; i++) { printf("%lld",t/b); t %= b; t *= 10; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...