BUAA Summer Practice 2017 #1 字符串专场

https://vjudge.net/contest/262753#overview

C - Regular Number HDU - 5972

bitset temp, temp[i]=1表示 此前i个位置都能完全匹配,&=bt[x-'0']来递推

int n,a[1111][12];
char s[5000050];
int main()
{
    while(~scanf("%d",&n))
    {
        bitset<1000> bt[11];
        re(i,0,9)bt[i].reset();
        re(i,1,n)
        {
            int x;inin(x);
            re(j,1,x)
            {
                int y;inin(y);
                bt[y][i-1]=1;
            }
        }
        strin(s+1);
        int len=strlen(s+1);
        while(s[len]<'0'||s[len]>'9')len--;
        bitset<1000> temp;
        temp.reset();
        re(i,1,len)
        {
            temp<<=1;
            temp[0]=1;
            temp&=bt[s[i]-'0'];
            if(temp[n-1]==1)
            {
                fwrite(s+i-n+1,sizeof(s[0]),n,stdout);
                puts("");
            }
        }
    }
    return 0;
}
上一篇:UCF Local Programming Contest 2013(Practice)赛后总结


下一篇:Math 2568 Practice Final