Piyush and magical park

sir mera code test case 3 and 4 kyu nahi pass kar raha hai
#include
using namespace std;

int main()
{
int n,m;
cin>>n;
cin>>m;
char a[1000][1000];
int k;
cin>>k;
int s;
cin>>s;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>a[i][j];
}
}
int found=0;
for(int h=0;h<n;h++)
{
if(s<=k)
{
found=1;
break;
}
for(int l=0;l<n;l++)
{
s=s-1;
if((a[h][l]==’#’)||(l==n-1))
{
break;
}
else if(a[h][l]==’*’)
{
s=s+5;
}
else if(a[h][l]==’.’){
s=s-2;
}
}
}

if(found==1)
{
cout<<β€œNo”;
}
else
{
cout<<β€œYes”<<endl;
cout<<s;
}
return 0;
}

1 Like

mam mere code m galat kya tha please tell me so that i will not make it again…

please share the code in cb ide

1 Like

if else ki positioning glt h

yeh extra likha h
then if ( j != n-1) walli condition add hogi

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like