DAPC21-094.Histogram
Medium · 1 s · 256 MB
- icpc
- dapc
- 2021
The term “histogram” was first introduced in 1895 by Karl Pearson. This is also the year that the portable electric drill was invented. It may not be a coincidence that we speak about “data drilling” today. Most things back then were not electric however, and histograms were still hand crafted. Nowadays, we like things electric and automated. The Bureaucratic Affiliation for Printing Charts needs to create a lot of histograms for a lot of data points, so they come to you for help to automate the printing of histograms.
Given a list of data points, print a histogram.
Giriş formatı
The input consists of:
• One line containing three integers , , and (), the number of bins, the size per bin, and the number of data points, respectively.
• One line containing integer data points ().
Çıxış formatı
Output the histogram. That is, write a rectangle of characters. The rectangle should be as wide as the number of bins. Each column of the rectangle should have
• a “-” at the bottom;
• on top of that, as many “#” as there are items in the bin;
• on top of that, as many “.” as are needed to fill out the rectangle.
The rectangle should be just high enough to display a “#” for each element in every bin, but no higher.
Qeyd
Source: Delft Algorithm Programming Contest 2021 · Author: Abe Wits · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license.
Nümunələr
Giriş #1
3 1 6 1 2 3 2 1 2
Çıxış #1
.#. ##. ### ---
Giriş #2
3 10 5 1 9 11 29 24
Çıxış #2
#.# ### ---