Product Modulo help!

Why? Your logic have AC?

yesss
print(n%m) :slight_smile:

1 Like

Damn… weak af… Can you please help me in this too… please please please

I divide the n/m and then checked whether it’s divisible by 2 or not. It passed half of the test cases… where must I have gone wrong?

Not weak, Wrong test cases LOL.
They also forgot it.
Test Case #3 fails with my soln

1 Like

:joy::joy::joy::rofl::rofl: bhai bhai

whats your solution ?

number of 1’s=k and then (n-k)%m

1 Like

Local contest requires local solution

2 Likes

XD

1 Like

Bro. Can you please help this alone? Please. Thanks

check n%(m+1).
if 0 then no;
else yes;

1 Like

Yes. This gave AC. Can you please explain? Thanks

Can you explain?

Yes , Its simple.
Whoever remains with m+1 tiles will loose surely because he can’t pick all the tiles and must pick at least one tile and hence the opponent can pick all the remaining tiles.
Therefore optimal game play is to play such that the other player is left with m+1 tiles.

3 Likes

Thanks a lot bro. Will this algo work out?
First time… the player takes m-1… then from that… even if the player takes m cards… the first player would end up winning. Will this theory work out? Thank you so much for reply

Nope.
The only point is to land your opponent on m+1 cards.
So if the no. of cards is 2m+2 or 3m+3 or k*(m+1) initially no matter what the first player choose the second player would always leave first player with m+1 cards in the end.

1 Like

Bro. :hushed::hushed:. How do you even think of these solutions bro. Please show me the treasure :pleading_face:

No treasure :sweat_smile:.
Initially logic and observation will help more . Later through upsolving you can learn new data structures and algos.
Note - I suck at upsolving :disappointed: .

No you don’t :roll_eyes:

I_returns returns…

2 Likes