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

CodeAdda Beta Round #32 Solutions

Правка en1, от Adz7, 2020-12-27 20:28:04

Problem 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: 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: 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: 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, ...}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Adz7 2020-12-31 10:45:56 6 Tiny change: 't/problem/379/A\n\nIf all' -> 't/problem/459/B\n\nIf all'
en2 Английский Adz7 2020-12-27 20:35:58 204
en1 Английский Adz7 2020-12-27 20:28:04 924 Initial revision (published)