I getting an error in 2 test cases. where is a mistake?
let me know.
I getting an error in 2 test cases. where is a mistake?
let me know.
Deepak pls share your code by saving on ide…so that I could check it…
#include
using namespace std;
int main() {
int N,M,K,S;
cin>>N>>M>>K>>S;
char arr[100][100];
bool check=true;
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{
char ch=arr[i][j];
if(S<K)
{
check=false;
break;
}
if(ch=='*')
{
S+=5;
}
else if(ch=='.')
{
S-=2;
}
else
{
break;
}
if(j!=N-1)
{
S--;
}
}
}
if(check)
{
cout<<"Yes"<<"\n"<<S<<"\n";
}
else
cout<<"No"<<"\n";
return 0;
}
Deepak, I have edited your code… Try to submit it now…