HDU 1022
2012-03-07 13:14
134 查看
#include<stdio.h> int main() { char a[10000],b[10000],s[10000]; int i,n,top,f[10000],j,count; while(scanf("%d",&n)!=EOF) { getchar(); for(i=0;i<n;i++) a[i]=getchar(); getchar(); for(i=0;i<n;i++) b[i]=getchar(); getchar(); top=0; s[top]=a[0]; j=0; count=1; f[0]=0; for(i=1;i<=n;i++) { while(top>=0&&s[top]==b[j]) { f[count]=1; j++; count++; top--; } if(i!=n) { top++; s[top]=a[i]; f[count++]=0; } } if(j==n) { printf("Yes.\n"); for(i=0;i<2*n;i++) if(f[i]) printf("out\n"); else printf("in\n"); printf("FINISH\n"); } else printf("No.\nFINISH\n"); } }
相关文章推荐
- HDU 1022 Train Problem I
- hdu 1022 Train Problem I(栈的应用)
- HDU-1022 Train Problem I (栈的简单应用)
- hdu 1022 Train Problem I(栈)
- hdu1022 Train Problem I
- HDU1022--Train Problem I
- HDU 1022 Train Problem I (stack)
- HDU 1022
- hdu 1022
- hdu 1022(列车进栈出栈) Train Problem I
- HDU 1022 Train Problem I && PAT 5-2 列车厢调度 栈
- hdu 1022 Train Problem I
- HDU 1022
- HDU 1022
- hdu 1022 Train Problem I(stack)
- hdu1022 Train Problem I
- HDU-1022 Train Problem I(栈)
- HDU--1022 -- Train Problem I [线性表之栈]
- hdu 1022 Train Problem I (栈的操作,还水了半天)
- HDU - 1022