pls help me my first submission...

#include

int main()
{

int t,i=-1,j=0,a[100],c[100],b;

cout<<"";
cin>>t;
for(b=0;b<t;b++)
{

cin>>a[b]>>c[b];
}
b=0;
while(b!=t)
{
i=i+2;
if(i>a[b])
{
cout<<"bob\n";
i=-1,j=0;
b++;
}
else
j=j+2;
if(j>c[b])
{
cout<<"limak\n";
j=0,i=-1;
b++;
}
}
return 0;
}

this is my first submission and it is not submitting due to compilation erro can u pls help…some one told to do chnages but that didn’t go well… i removed conio.h and also edited iostream and removed clrsr(),getch(),and wrote int main instead of void main()…still not wrokinig which language i have to select it has many types for c++

cout<<"" remove this statement

Also its #include<>, not include<>

I don’t know which problem you are referring to here. So, my answer would focus only on the compilation aspect and not on the logic. If you include C++ header file, you should use namespace std as well since cin and cout are defined there or you should use std:: before every call to std namespace defined functions e.g. std::cout. Also, include the preprocessor directive # before include.

Final compilable code is as follows:

#include<iostream>
using namespace std;

int main() {
	int t,i=-1,j=0,a[100],c[100],b;
	
	cout<<""; cin>>t; 
	
	for(b=0;b<t;b++) {
		cin>>a[b]>>c[b]; 
	} 
	
	b=0; 
	
	while(b!=t) { 
		i=i+2; 
		if(i>a[b]) { 
			cout<<"bob\n"; i=-1,j=0; b++; 
		} else j=j+2; 
		if(j>c[b]) { 
			cout<<"limak\n"; j=0,i=-1; b++; 
		} 
	} 
	
	return 0; 
}

Also, this is not a type of problem which any beginner on codechef would face. This is just a typical programming language issue. Your editor’s compilation error message should have given you some hints.

2 Likes