10679-I Love String!!! - Shallow judge data
Posted: Sun Aug 19, 2007 5:37 pm
this code gets AC!:
Which is totaly wrong! because It assumes that every query string will be found from index 0, but In the problem statement it is not mentioned any where! and from the common sense it is understandable that the query string could be found at any where in the main text.
Code: Select all
#include <stdio.h>
#include <string.h>
#define MAX 100010
int main()
{
char S[MAX],q[1010],c;
int i,j,query,test;
scanf("%d%c",&test,&c);
while( test-- )
{
gets(S);
scanf("%d%c",&query,&c);
while( query-- )
{
gets(q);
j = 0;
for( i=0; q[i]; i++ )
{
if( q[i] != S[i] )
{
j = 1;
break;
}
}
if( j )
printf("n\n");
else
printf("y\n");
}
}
return 0;
}