PersonalCorpus 版 (精华区)

1267662 Big Guava ... 10415 Accepted
0:00.050 64 2002/11/28 10:53:34.734


void main()
{
#ifndef ONLINE_JUDGE
    freopen("k:\\uva\\contest11-23oibh\\iE","r",stdin);
    freopen("k:\\uva\\contest11-23oibh\\oE","w",stdout);
#endif
    int i,j,k,t,sum[14];
    char s[300],c[11];
    static char p[14][11]={ {0,0,1,1,0,0,0,0,0,0,0},
    {0,0,1,0,0,0,0,0,0,0,0},{0,0,1,1,1,0,0,1,1,1,1},
    {0,0,1,1,1,0,0,1,1,1,0},{0,0,1,1,1,0,0,1,1,0,0},
    {0,0,1,1,1,0,0,1,0,0,0},{0,0,1,1,1,0,0,0,0,0,0},
    {0,1,1,1,0,0,0,0,0,0,0},{0,1,1,0,0,0,0,0,0,0,0},
    {0,0,0,1,0,0,0,0,0,0,0},{0,1,1,1,1,0,0,1,1,1,0},
    {0,1,1,1,1,0,0,1,1,0,0},{0,1,1,1,1,0,0,1,0,0,0},
    {0,1,1,1,1,0,0,0,0,0,0} };
    scanf("%d\n",&t);
    while (t--) {
        gets(s);
        memset(sum,0,sizeof(sum));
        memset(c,0,sizeof(c));
        for (i=0;s[i];i++) {
            if ((s[i]>='a')&&(s[i]<='g')) j=s[i]-'a';
            else if ((s[i]>='A')&&(s[i]<='G')) j=s[i]-'A'+7;
            else continue;
            for (k=1;k<11;k++) if (!c[k]&&p[j][k]) sum[k]++;
            memcpy(c,p[j],sizeof(c));
        }
        for (i=1;i<10;i++) printf("%d ",sum[i]);
        printf("%d\n",sum[10]);
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.798毫秒