I am getting TLE in whie submitting this code for BISHOPS spoj.pl/problems/BISHOPS/
Anybody please tell me what's wrong with this code
include
//#include
include
include
using namespace std;
main()
{
char str[110],c;
int x,i,n,mul,l,carry;//cin>>str;
while(!(cin.eof()))
{ scanf("%s",str);
x=0;
l=strlen(str);carry=0;
int *p=new int[l+1];
p[l]=0;
for(x=0;x p[l-1-x]=str[x]-48;
if(l==1&&p[0]==1){cout< if(l==1&&p[0]==0){cout< for(x=0;x {mul=2*p[x];
p[x]=mul%10+carry;
carry=mul/10;
//cout<<"carry="< }
if(carry)p[l]=1;//<<"pl==="<
if(p[0]>=2)p[0]-=2;
else
{//cout<<"enterd sustsdction\n";
int drag=1;
while(p[drag]==0)drag++;
if(drag>l){p[0]==0?cout<
p[drag--]-=1;
while(drag!=0)p[drag--]+=9;
p[drag]+=8;
}
if(p[l]==1)cout<<1;
for(x=l-1;x>=0;x--)
printf("%d",p[x]);//cout<<p[i]-2;
cout<<"\n";//cin>>str;
}//end while
}