PersonalCorpus 版 (精华区)

1243688 Big Guava ... 10324 Accepted
0:00.154 5276 2002/11/17 06:46:47.525

void main()
{
#ifndef ONLINE_JUDGE
    freopen("k:\\uva\\i10324","r",stdin);
    freopen("k:\\uva\\o10324","w",stdout);
#endif

    int c[1000010];
    char s[1000015];
    int i,j,k,n,t=0;

    while (gets(s)!=NULL) {
        printf("Case %d:\n",++t);
        i=0;
        for (j=0;s[j];j++) if (s[i]!=s[j]) {
            while (i!=j) {
                c[i]=j-i;
                i++;
            }
            i=j;
        }
            while (i!=j) {
                c[i]=j-i;
                i++;
            }

        scanf("%d\n",&n);
        while (n--) {
            scanf("%d%d\n",&i,&j);
            if (i>j) { k=i; i=j; j=k; }
            if (c[i]>j-i) printf("Yes\n"); else printf("No\n");
        }
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:5.259毫秒