My issue
whats wrong with it
My code
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
if(b==1){
if(a==4 || a==0){
cout<<"On"<<endl;
}
else cout<<"Ambiguous"<<endl;
}
else if(b==0){
if(a==4 || a==0) cout<<"Off"<<endl;
else cout<<"On"<<endl;
}
}
return 0;
}
Problem Link: DARLIG Problem - CodeChef
@raman067
These are the necessary conditions to take , to get correct answer.
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
if(n%4==0)
{
if(k==1)
{
cout<<"ON";
}
else
{
cout<<"OFF";
}
}
else
{
if(k==0)
cout<<"ON";
else
cout<<"Ambiguous";
}
cout<<endl;
}
return 0;
}
You didn’t used curly brackets after he else which is necessary syntax if u are not using in if then also not in else and vice versa. Try with this or if not then logical issue.
because a can be any value and also more than 4 but you have checked only 4 and not the other possible levels where the torch can be on like 8 ,12 ,16 …