Skip to content
Back to libraryPart 1 · Foundations

1.1Input and output

Before you start

No earlier chapter is needed; this is a good place to start. Overall level: First programs.

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.

  1. 1Two countersTwo counters hold a items and b items. Print the total number of items in both counters.ApplyNot started
  2. 2Frame lengthA rectangular display has integer width w and height h. Print its perimeter, the total length of its four sides.ConnectNot started
  3. 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
  4. 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

Read the lesson