Raj Ariyan wrote:Do u get any idea ?
Thanks for your answere.
I use this process. But it takes 0.141
Any body, want to say some thing???
Ibrahim
Moderator: Board moderators




#include<stdio.h>
#include<string.h>
#define MAX 1000001
#define M 1000001
char num[MAX];
int main()
{
int counter[M];
long n, a, b, i, j,len,test = 1;
char pre, post;
//freopen("10324.in","r",stdin);
//freopen("10324.out","w",stdout);
while(scanf("%s",num)!=EOF)
{
if(num[0]=='\0')
break;
len = strlen(num);
for(i = 0; i<= len;i++)
counter[i] = 0;
pre = num[0];
for(i = 1;i<len;i++)
{
post = num[i];
if(pre!=post)
{
for(j = i;j<len;j++)
counter[j]++;
pre = post;
}
}
scanf("%ld",&n);
printf("Case %ld:\n",test++);
for(i = 1;i<=n;i++)
{
scanf("%ld %ld",&a,&b);
if(counter[a]==counter[b])
printf("Yes\n");
else
printf("No\n");
}
}
return 0;
}for(i = 1;i<len;i++)
{
post = num[i];
if(pre!=post)
{
for(j = i;j<len;j++)
counter[j]++;
pre = post;
}
}
Users browsing this forum: No registered users and 1 guest