cookoff_code

//what is wrong with the code for cookoff question
#include
using namespace std;
int main()
{
int T,N;
int cakewalk=0,simple=0,medium=0,hard=0,easy=0;
cin>>T;
while(T!=0)
{
cin>>N;
string a[N];
for(int i=0;i<N;i++)
{
cin>>a[i];
}
for(int i=0;i<N;i++)
{
if(a[i]==“cakewalk”)
cakewalk+=1;
else if(a[i]==“simple”)
simple+=1;
else if(a[i]==“easy”)
easy+=1;
else if((a[i]==“easy-medium”)||(a[i]==“medium”))
medium+=1;
else if((a[i]==“hard”)||(a[i]==“medium-hard”))
hard+=1;
else
cout<<“wrong input”;
}
if((cakewalk>=1)&&(simple>=1)&&(easy>=1)&&(hard>=1)&&(medium>=1))
cout<<“yes”<<endl;
else
cout<<“no”<<endl;
T–;
}
return 0;}

You are doing it wrong brother.

  1. First of all you have not defined n.

  2. You are incrementing like c+=“1”; but you should increment like c+=1;

  3. For comparing you should use == and you are using ="="

  4. You are printing “wrong input” ,which is not required.

  5. Follow the output format exactly as it is given in the question.

Now You can solve this problem easily,just look this code I have made it easy for you to use and understand.

#include<bits/stdc++.h>

#define ll long long int

using namespace std;

int main()
{

int t;

cin>>t;

while(t--)

{

	ll n;

	cin>>n;

	ll c=0,s=0,e=0,m=0,h=0;

	for(ll i=0;i<n;i++)

	{

		string x;

	cin>>x;

	if(x.compare("cakewalk")==0)

	c++;

	else if(x.compare("simple")==0)

	s++;

	else if(x.compare("easy")==0)

	e++;

	else if(x.compare("easy-medium")==0 || x.compare("medium")==0)

	m++;

	else if(x.compare("medium-hard")==0 || x.compare("hard")==0)

	h++;

}

if((c>=1) && s>=1 && e>=1 && m>0 && h>0)

cout<<"Yes"<<endl;

else

cout<<"No"<<endl;

}

}

//