Submission #2432

#TimeUsernameProblemLanguageResultExecution timeMemory
2432pl0892029생일수 II (GA4_birthday2)C++98
25 / 100
63 ms40340 KiB
#include <cstdio> char st[200002], ed[200002]; int bn[10000001], 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); }
#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...