Problem 3Problem code: CMB03 |
Given two binary strings, A (of length 10) and B (of length 5), output 1 if B is a substring of A and 0 otherwise.
Input
The first line contains the number of test cases n. This is followed by n lines each consisting of pairs of binary strings A and B separated by a single space.
Output
output 1 if B is a substring of A and 0 otherwise.
Example
Input: 1 1010110010 10110 Output: 1
| Author: | vishesh_sigma |
| Date Added: | 28-01-2010 |
| Time Limit: | 50 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

how can this be wrong so many
how can this be wrong so many times ?
#include<stdio.h> void
#include<stdio.h>
void main()
{
char a[10],b[5],c;
int i,j,n,f=0,temp,k;
printf("n Enter the number of cases");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("n Enter the super string");
scanf("%s",&a);
printf("n Enter the sub string");
scanf("%s",&b);
j=0;
while(j<10)
{
temp=j;
for(k=0;k<5;)
{
if(a[j]==b[k])
{
j++;
k++;
if(k==4)
{
f=1;
break;
}
}
else
{
j=temp+1;
k=0;
}
}
}
if(f==1)
printf("n %d",f);
else
printf("0");
}
@Admin: I would really like
@Admin: I would really like to know if my code is wrong. Please look at my latest submission.