Комментарии

Thanks for sharing, Aditya!

На MikeMirzayanovRule about third-party code is changing, 16 месяцев назад
0

Hello Mike,

I have been penalized for my submission of 2043B, but I did not copy it from anyone at all. The question was straightforward, where we needed to check whether a number formed by digit d, repeated n times, is divisible by 1, 3, 5, 7, or 9.

For 1, 3, 5, and 9, the solution was relatively simple:

For 1, it's always true. For 3, d needs to be divisible by 3, or n≥3, ensuring the number repeats a sufficient number of times to be divisible by 3. For 5, the number can only be divisible by 5 if d is 5. For 9, it’s similar to 3, except d must be 9, or n≥6 or d is a multiple of 3 and n≥3 . The only tricky part was for 7. A solution is straightforward when d=7. For other cases, I derived the relation by writing it down manually with pen and paper for a few minutes. Eventually, I discovered that when n≥3, divisibility by 7 can be proven using the following logic:

When n=4, the number d, repeated 4! times, can be represented as:

(d repeated 3! times)×1e18 + (d repeated 3! times)×1e12 + (d repeated 3! times)×1e6 + (d repeated 3! times). Since d repeated 3! times is divisible by 7, d repeated 4! times will also be divisible by 7. Similarly, this can be proven for all n≥3.

This is how I approached the solution.

And I believe this was a pretty straightforward solution because we just needed to find conditions for 7 and mostly would have also done in the similar way and they have not been penalised.

I firmly believe that neither I nor the other alleged person copied in any way. Please review this, as I solved the problem meticulously and was very happy with my approach.