There's a confusing factor in the 'Curious' badge. The "Positive question record".
(total questions - negative questions - closed - deleted)/total questions
is the formula of the question record. (negative, closed and deleted 'stack' with each other. that means if a question is negative and closed, it counts as two minus.)
Luckily, you know a list of your questions. Make a program that calculates your question record.
The Input
You will be given an array of question datas. A question data is made of 2 datas.
- The votes (integer)
- The state (
o
(open),c
(closed),d
(deleted),b
(closed and deleted) is the default, You may change the type and the characters for each states.)
Examples
[[-1,'o'],[1,'o']]
=>0.5
(2 total, 1 minus points)[[-1,'d'],[2,'c']]
=>-0.5
(2 total, 3 minus points)[[-1,'b']]
=>-2
(1 total, 3 minus points)[[23,'o'],[7,'c'],[7,'c'],[-1,'o'],[-5,'b'],[-11,'d'],[-3,'d'],[-3,'b'],[-15,'b']]
=>-0.77778
(The precision is 5 digits past decimal point, rounded half-up. fractions are acceptable) (Oh my, my question record is horrible.)- ` ('Minus points' is the sum of negative, closed and deleted.)
Rules
- Format of input is your choice. You don't necessarily need to use the format in the Examples.
0
, closed questions and deleted questions as-1
and closed and deleted questions as-2
? Where is the limit? \$\endgroup\$