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

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

Автор Adz7, история, 4 года назад, По-английски

Problem A: https://codeforces.me/problemset/problem/996/A

The problem is to minimize x1+x2+x3+x4+x5 given that x1+5x2+10x3+20x4+100x5=n. It is pretty simple to see that we can operate greedily: take as many 100 as we can, then 20, then 10, etc.

Problem B: https://codeforces.me/problemset/problem/379/A

Let cur_a amount of new candles, cur_b — the amount of burnt out. Initially, cur_a = a, cur_b = 0, after burning all cur_a new candles, amount of days incremented by cur_a and curb += cur_a, let's make all burnt out candles into new cur_a = curb / b , repeat this algorithm until we can make at least one new candle.

Problem C: https://codeforces.me/problemset/problem/459/B

If all numbers are equal then the answer will be n * (n - 1) / 2, otherwise the answer will be cnt1 * cnt2, where cnt1 is the number of our maximum elements and cnt2 is the number of our minimum elements.

Problem D: https://codeforces.me/problemset/problem/450/B

We can easily find that every 6 numbers are the same. It's like {x, y, y - x,  - x,  - y, x - y, x, y, y - x, ...}

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

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