답안 #2430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2430 2013-07-21T10:39:22 Z pl0892029 생일수 II (GA4_birthday2) C++
25 / 100
6 ms 5180 KB
#include <cstdio>

char st[200001], ed[200001];
int bn[1000001], front, rear;
int mod=19980305;

int main() {
    int sp=0, se=0, ep=0, ee=0;
    gets(st); gets(ed);
    
    front = rear = 0;
    bn[rear++]=0;
    
    bool secheck, eecheck;
    
    while(st[sp] || ed[ep]) {
        secheck=false;
        eecheck=false;
        
        if( front==se ) secheck=true;
        if( front==ee ) eecheck=true;
        
        int temp = bn[front++];
        if( secheck && st[sp]=='3' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='3' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+3)%mod;
        if( secheck && st[sp]=='5' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='5' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+5)%mod;
        if( secheck && st[sp]=='8' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='8' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+8)%mod;
    }
    int ans = 0;
    for(int i=se;i<ee;i++) {
        ans += (int)((long long)bn[i]*bn[i+1]%mod);
        ans %= mod;
    }
    printf("%d",ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5180 KB Output is correct
2 Correct 0 ms 5180 KB Output is correct
3 Correct 0 ms 5180 KB Output is correct
4 Correct 0 ms 5180 KB Output is correct
5 Correct 0 ms 5180 KB Output is correct
6 Correct 0 ms 5180 KB Output is correct
7 Correct 0 ms 5180 KB Output is correct
8 Correct 0 ms 5180 KB Output is correct
9 Correct 0 ms 5180 KB Output is correct
10 Correct 0 ms 5180 KB Output is correct
11 Correct 0 ms 5180 KB Output is correct
12 Correct 0 ms 5180 KB Output is correct
13 Correct 0 ms 5180 KB Output is correct
14 Correct 0 ms 5180 KB Output is correct
15 Correct 0 ms 5180 KB Output is correct
16 Correct 0 ms 5180 KB Output is correct
17 Correct 0 ms 5180 KB Output is correct
18 Correct 0 ms 5180 KB Output is correct
19 Correct 0 ms 5180 KB Output is correct
20 Correct 0 ms 5180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5180 KB Output is correct
2 Correct 0 ms 5180 KB Output is correct
3 Correct 0 ms 5180 KB Output is correct
4 Correct 0 ms 5180 KB Output is correct
5 Correct 0 ms 5180 KB Output is correct
6 Correct 0 ms 5180 KB Output is correct
7 Correct 0 ms 5180 KB Output is correct
8 Correct 0 ms 5180 KB Output is correct
9 Correct 0 ms 5180 KB Output is correct
10 Correct 0 ms 5180 KB Output is correct
11 Correct 0 ms 5180 KB Output is correct
12 Correct 0 ms 5180 KB Output is correct
13 Correct 0 ms 5180 KB Output is correct
14 Correct 0 ms 5180 KB Output is correct
15 Correct 0 ms 5180 KB Output is correct
16 Correct 1 ms 5180 KB Output is correct
17 Correct 0 ms 5180 KB Output is correct
18 Correct 0 ms 5180 KB Output is correct
19 Correct 0 ms 5180 KB Output is correct
20 Correct 0 ms 5180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 5176 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 5176 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 5176 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -