12
In a steam-punk multidimensional world, our boss wants to affix printed index labels to each drawer in our conglomerate's multidimensional file cabinet.
The boss wants to typeset the entire label sheet as a single form, using a font bought only for this purpose, so we have to order the sorts (metal symbol pieces). Since sorts are very expensive, our order must be for the exact count of each digit-symbol.
For a given (by any means) set of lengths of dimensions ≥ 0, return (by any means) our order, which is the frequency table of digits required to typeset all the Cartesian coordinates. It must be arranged by keyboard order of appearance (i.e. 0 after 9), and may not include orders of 0 sorts, so if no sorts are to be ordered at all (because a dimension has length 0); print nothing.
- Bonus of -3 sorts if your code can handle (i.e. print nothing) 0 dimensions too.
- Final newline chars are acceptable.
- Prohibition on standard loopholes apply.
- As mentioned, sorts are expensive, this is therefore codecolf.
A kind soul may edit this challenge to include automated scoring, so include a header like:# LanguageName, 123 sorts
Test cases
Given 11
, print:
1 4
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
0 1
because the needed labels are 1
, 2
, 3
, 4
, 5
, 6
, 7
, 8
, 9
, 10
, and 11
.
Given 2 3
, print:
1 5
2 5
3 2
because the needed labels are 1 1
, 1 2
, 1 3
, 2 1
, 2 2
, and 2 3
.
Given 2 0
, print an empty line:
or nothing.
Given 1 2 3
, print:
1 11
2 5
3 2
because the needed labels are 1 1 1
, 1 1 2
, 1 1 3
, 1 2 1
, 1 2 2
, and 1 2 3
Given 5 5 5 5
, print:
1 500
2 500
3 500
4 500
5 500
And no, I'm not going to list all 625 labels.
I'm a little unclear about the output requirements. In the text, it says "return (by any means)", but the rest suggests that a very specific output format is required, and that it needs to be printed. Which one is it? E.g. talking about trailing newlines seems completely redundant if the output format can be anything. – Reto Koradi – 2015-11-08T20:29:27.043
1@RetoKoradi the format has to look more or less as shown, but it may be in an interactive session, a file, a pop-up, STDOUT, etc. Do you have a suggestion as to how I could phrase this to make it clearer? – Adám – 2015-11-08T21:39:05.013