i am getting repeatdly WA in this question link is
https://www.spoj.pl/problems/ACODE/
plzz provide me some test cases where my code
fails.............................
my code is
# include<cstdio>
# include<cstring>
int main()
{
while(1)
{
char a[50100];
scanf("%s",&a);
int l1=strlen(a);
if(a[0]=='0')
break;
long long int i,j,k=0;
for(i=l1-1;i>=0;i--)
a[i+1]=a[i];
long long int dp[50100]={0};
dp[0]=1;
dp[1]=1;
for(i=2;i<=l1;i++)
{
long long int s=(a[i-1]-'0')*10+(a[i]-'0');
if(a[i]!='0'&&s>=0&&s<=26&&a[i-1]!='0')
dp[i]=dp[i-1]+dp[i-2];
else
dp[i]=dp[i-1];
}
for(j=0;j<=i;j++)
{
a[j]='\0';}
printf("%lld\n",dp[i-1]);
}
return 0;
}
--
*WITH REGARDS,*
*
*
*KARTIK SACHAN*
*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.