Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

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

Hi!

I've come across this piece of code of a (modified?) sieve and I'm trying to figure out what sieve[i] means and how it works, specially the 2nd for.

Would you help me, please?

Thanks!

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

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

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

I've come across this probability problem and could not solve it. In order to learn, I searched for the solution on the internet and found out that people just printed 1/2. i.e., the answer, no matter the value of n, is always 50%.

Why is that so? I tried making some DP for testing values under ~20 and only when n = 2 the answer is indeed 1/2.

Can someone give me some help on this tough (for me) one?

Appreciate the help!

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

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