WHY MY CODE GETTING WRONG ERROR
This is not your submission link. Go to my submissions and get the URL and update it.
#include
using namespace std;
int main() {
// your code goes here
int test_cases;
cin >> test_cases;
while (test_cases–)
{
int no_of_games;
cin >> no_of_games;
while (no_of_games–)
{
int intial_state, number, final_state;
cin >> intial_state >> number >> final_state;
int count = 0;
if (intial_state == 1 && final_state == 1 && number % 2 == 0)//H H H H H
{
int a = number / 2;
count = a;
}
else if (intial_state == 1 && final_state == 1 && number % 2 != 0)
{
int a = (number / 2);
count = a;
}
else if (intial_state == 1 && final_state == 2 && number % 2 == 0)//H H H H H
{
int a = number / 2;
count = a;
}
else if (intial_state == 1 && final_state == 2 && number % 2 != 0)
{
int a = (number / 2) + 1;
count = a;
}
else if (intial_state == 2 && final_state == 1 && number % 2 == 0)//T T T T T
{
int a = number / 2;
count = a;
}
else if (intial_state == 2 && final_state == 1 && number % 2 != 0)
{
int a = number / 2;
count = a;
}
else if (intial_state == 2 && final_state == 2 && number == 0)
{
int a = number / 2;
count = a;
}
else if (intial_state == 2 && final_state == 2 && number != 0)
{
int a = (number / 2)+1;
count = a;
}
else {}
cout << count << endl;
}
}
return 0;
}
Got it😇