Блог пользователя dtdong08

Автор dtdong08, 6 месяцев назад, По-английски

Today I am studying about the Miller–Rabin primality test (the deterministic version). After having learned enough theory, I started trying to solve this problem on Library Checker. However, regardless of how much I tried, I kept getting TLE if I implement binary modulo multiplication or WA if I implement modulo multiplication with long double. Can anyone please help me optimize my current code or give me some crazy tricks so I can AC this problem?

Btw, I am not allowed to use __int128 due to my teacher ~

Also, here is my code, it is slightly long (105 LOC) so I put it in a Spoiler
  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится