what is wrong in d code

#include
using namespace std;
int main()
{
int t,n,k,i;
cin>>t;
while(t–)
{
cin>>n>>k;

		if(n==1)
		{
		if(k==1)
		cout<<"1"<<endl;
		else
		cout<<"-1"<<endl;
		}
		else
		{
		
		if(k>n/2)
		cout<<"-1"<<endl;
		else {
		
		for(i=1;i<=k;i++)
		{
			cout<<(i<<1);
			
			
		
		}cout<<endl;
		}
		}
	
		
		
	}
	return 0;
}

Are you trying to solve http://www.codechef.com/problems/AMMEAT2 ?

You are not printing spaces in for loop…

2 Likes

@shashank9415 make it easier to others to help you. provide links to the problem, etc.