Product Modulo help!

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