Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

https://www.codechef.com/problems/EFFPAINT This is a challenge problem in codechef where we have to minimize the score. Can someone explain a good approach for this problem.

Also this is the editorial for the problem https://discuss.codechef.com/questions/6549/effpaint-editorial

I am not able to understand the editorial. The use of terms cells, rectangles and corners is not much clear in it. Can someone please explain this approach? One can refer to the setter's solution for better understanding on the approach used.

Kindly help.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

Автор dragneel3131, история, 7 лет назад, По-английски

I have to calculate the value of (a/b) mod p where p may or may not be a prime number. For p being prime, I can simply find (b inverse for mod p) using euclid theorem or little fermat theorem, and perfrom (a * inverse(b)) % p. But in case p is not prime, how can I find the solution? I think there is a method by doing prime factorization of p and then using chineese remainder theorem but not sure about it. Can anyone help how can I solve this problem?

a and b both are less than p.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится