# FAVOURITENUM - Editorial

Tester: udhav2003
Editorialist: iceknight1093

477

None

# PROBLEM:

Alice likes numbers that are both even and a multiple of 7.
Bob likes numbers that are both odd and a multiple of 9.

Given a number A:

• If Alice likes it, Alice will take it home
• If Bob likes it, Bob will take it home
• If neither of them like it, Charlie will take it home

Who will take the number A home?

# EXPLANATION:

It’s enough to simply follow what the statement says.

• Check whether Alice likes the number; if so, Alice will take it home.
For this, it needs to be checked whether A is both even and a multiple of 7.
This can be done by, for example, checking if (A%2 == 0 && A%7 == 0) (or an equivalent statement in your programming language).
• If the above check failed, check whether Bob likes the number.
Again, this can be done using an if condition, for example if (A%2 == 1 && A%9 == 0).
• If both Alice’s and Bob’s checks failed, the answer is Charlie.

# TIME COMPLEXITY

\mathcal{O}(1) per test case.

# CODE:

Editorialist's code (Python)
for _ in range(int(input())):
a = int(input())
if a%2 == 0 and a%7 == 0: print('Alice')
elif a%2 == 1 and a%9 == 0: print('Bob')
else: print('Charlie')