TOPIC

Wrong answer (10%)

Naftalina asked 1 year ago

include

using namespace std;

int main(){ bool player1 = true; int p, j1, j2, r, a; cin >> p >> j1 >> j2 >> r >> a;

if(p == 1){
  if((j1 + j2)%2 != 0){
    player1 = false;
    if(r == 1){
      player1 = true;
      if(a == 1)
        player1 = false;
    }
  }
  else
    player1 = true;
}
else{
  if((j1 + j2)%2 == 0){
    player1 = false;
    if(r == 1){
      player1 = true;
      if(a == 1){
        player1 = false;
      }
    }
  }
  else
    player1 = true;
}

if(player1 == true)
  cout << "Jogador 1 ganha!" << endl;
else
  cout << "Jogador 2 ganha!" << endl;

return 0; }

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.