My issue
even with correct output, code is not accepted
My code
#include <iostream>
using namespace std;
void odd(int m){
int k=-1;
for(int i=0;i<m;i++){
if(k==-1)
{ cout<<"0";
k=k*(-1);
}
else if (k==1)
{
cout<<"1";
k=k*(-1);
}
}
}
int main() {
int n;
cin>>n;
while(n--){
int m;
cin>>m;
if(m==4)
cout<<"1001"<<endl;
if(m==3)
cout<<"010"<<endl;
if(m>3 && m%2!=0)
{
odd(m);
cout<<endl;
}
if(m>4 && m%2==0)
{
cout<<"10";
odd(m-4);
cout<<"01"<<endl;
}
}
return 0;
}
Problem Link: ZOOZ Problem - CodeChef