Premise:
Your reputation is in Stack-Exchange Form if it can be represented by decomposing your medal counts (gold, silver, and bronze counted separately) into their base-10 digits and joining them in any given order, with a few caveats.
While decomposing, each
- Gold medal digit is worth three digits.
- Silver is worth two digits.
- Bronze is one digit.
- Additionally, since SE does not display a medal type if you do not have any, a count of 0 medals for a type will not yield a
[0]
.
Example:
[1 Gold, 2 Silvers, 3 Bronzes]
will decompose into[1,1,1,2,2,3]
. 321112 and 213121 are two examples of an SE-form number for these medals.[20 Golds, 0 Silvers, 20 Bronzes]
will decompose into[2,2,2,0,0,0,2,0]
. 20002022 is an SE-form number.[11 Golds, 0 Silvers, 0 Bronzes]
will decompose into[1,1,1,1,1,1]
. 111111 is the only SE-form number for this.
There will be no leading 0's when considering a SE number. E.g., in the 2nd example above, 00002222 -> 2222
would not be considered a SE-form number for [20,0,20]
.
Input/Output:
Input is a list/tuple/array/whatever of [reputation, gold_medals, silver_medals, bronze_medals]
which are all non-negative integers. This is the assumed order but can be changed. Just make a note in your answer if you do.
Output is any two consistent values for true and false.
Rules:
- Input will always be valid
- You will always have at least 1 Rep
- You can have no medals at all, which should always return false then.
- The medal counts have no bearing on reality. Having several hundred golds and no bronzes is fine.
- This is code-golf so shortest answer in bytes wins.
Test Cases:
#[Rep, Gold, Silver, Bronze] -> Output
[4, 0, 0, 4] -> True
[1447, 0, 4, 17] -> True
[74414, 4, 0, 17] -> True
[4444, 4, 0, 4] -> True
[4455, 0, 54, 0] -> True
[5355, 5, 0, 3] -> True
[53535, 5, 3, 0] -> True
[4444, 0, 0, 4444] -> True
[444, 4, 0, 0] -> True
[1234, 0, 0, 1234] -> True
[1234, 0, 0, 4321] -> True
[4444, 1, 0, 1] -> False
[5555, 5, 0, 55] -> False
[1234, 1, 23, 4] -> False
[1, 0, 0, 0] -> False
[1001001, 0, 10, 10] -> False
[bronze, silver, gold]
and a separated second inputreputation
? \$\endgroup\$