Practice: Input and output
0 of 4 solved
About these problems
Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.
- 1Two countersTwo counters hold a items and b items. Print the total number of items in both counters.ApplyNot started
- 2Frame lengthA rectangular display has integer width w and height h. Print its perimeter, the total length of its four sides.ConnectNot started
- 3Collected tokensA class records how many tokens it collected on each of n days: ai tokens on day i. Print the total number of tokens over all n days.ReasonNot started
- 4Packing batchesThere are n batches of badges, described by a list of n integers a1, a2, ..., an, where ai is the number of badges in batch i. All badges are put together and packed into boxes that each hold at most k badges. Print the minimum number of boxes needed to pack every badge. If there are no badges at all, the answer is 0.StretchNot started