답안 #13732

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13732 2015-03-28T15:45:50 Z gs14004 관대한 주인 (TOKI14_generous) C++14
100 / 100
12 ms 1084 KB
#include <cstdio>

long long mul(long long a, long long b, long long m){
    long long ret = 0;
    while (b) {
        ret += a * (b & 1023);
        b >>= 10;
        a <<= 10;
        ret %= m;
        a %= m;
    }
    return ret;
}
long long pw(int a, int x, long long 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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
9 Correct 0 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
11 Correct 0 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 0 ms 1084 KB Output is correct
14 Correct 0 ms 1084 KB Output is correct
15 Correct 0 ms 1084 KB Output is correct
16 Correct 0 ms 1084 KB Output is correct
17 Correct 0 ms 1084 KB Output is correct
18 Correct 0 ms 1084 KB Output is correct
19 Correct 0 ms 1084 KB Output is correct
20 Correct 0 ms 1084 KB Output is correct
21 Correct 0 ms 1084 KB Output is correct
22 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1084 KB Output is correct
2 Correct 3 ms 1084 KB Output is correct
3 Correct 6 ms 1084 KB Output is correct
4 Correct 9 ms 1084 KB Output is correct