6 kyu
How Much?
194 of 6,800g964
Description:
I always thought that my old friend John was rather richer than he looked, but I never knew exactly how much money he actually had. One day (as I was plying him with questions) he said:
- "Imagine I have between
m
andn
Zloty..." (or did he say Quetzal? I can't remember!) - "If I were to buy 9 cars costing
c
each, I'd only have 1 Zloty (or was it Meticals?) left." - "And if I were to buy 7 boats at
b
each, I'd only have 2 Ringglets (or was it Zloty?) left."
Could you tell me in each possible case:
- how much money
f
he could possibly have ? - the cost
c
of a car? - the cost
b
of a boat?
So, I will have a better idea about his fortune. Note that if m-n
is big enough, you might have a lot of possible answers.
Each answer should be given as ["M: f", "B: b", "C: c"]
and all the answers as [ ["M: f", "B: b", "C: c"], ... ]
. "M" stands for money, "B" for boats, "C" for cars.
Note: m, n, f, b, c
are positive integers, where 0 <= m <= n
or m >= n >= 0
. m
and n
are inclusive.
Examples:
howmuch(1, 100) => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"]]
howmuch(1000, 1100) => [["M: 1045", "B: 149", "C: 116"]]
howmuch(10000, 9950) => [["M: 9991", "B: 1427", "C: 1110"]]
howmuch(0, 200) => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"], ["M: 163", "B: 23", "C: 18"]]
Explanation of the results for howmuch(1, 100)
:
- In the first answer his possible fortune is 37:
- so he can buy 7 boats each worth 5:
37 - 7 * 5 = 2
- or he can buy 9 cars worth 4 each:
37 - 9 * 4 = 1
- The second possible answer is 100:
- he can buy 7 boats each worth 14:
100 - 7 * 14 = 2
- or he can buy 9 cars worth 11:
100 - 9 * 11 = 1
Note
See "Sample Tests" to know the format of the return.
Fundamentals
Stats:
Created | Jul 26, 2015 |
Published | Jul 26, 2015 |
Warriors Trained | 32548 |
Total Skips | 10548 |
Total Code Submissions | 38760 |
Total Times Completed | 6800 |
Ruby Completions | 194 |
Python Completions | 1699 |
JavaScript Completions | 1187 |
Haskell Completions | 98 |
Java Completions | 811 |
C# Completions | 417 |
Clojure Completions | 74 |
CoffeeScript Completions | 11 |
TypeScript Completions | 142 |
C++ Completions | 598 |
Elixir Completions | 82 |
PHP Completions | 283 |
Crystal Completions | 8 |
F# Completions | 40 |
C Completions | 181 |
Rust Completions | 221 |
Swift Completions | 172 |
Go Completions | 296 |
R Completions | 57 |
Shell Completions | 52 |
OCaml Completions | 18 |
Kotlin Completions | 153 |
Fortran Completions | 10 |
Julia Completions | 23 |
Scala Completions | 83 |
PowerShell Completions | 28 |
Nim Completions | 6 |
Reason Completions | 4 |
Racket Completions | 15 |
Prolog Completions | 9 |
Pascal Completions | 13 |
Factor Completions | 10 |
Lua Completions | 34 |
Dart Completions | 118 |
Perl Completions | 8 |
Elm Completions | 9 |
D Completions | 8 |
Erlang Completions | 3 |
Total Stars | 381 |
% of votes with a positive feedback rating | 80% of 1051 |
Total "Very Satisfied" Votes | 718 |
Total "Somewhat Satisfied" Votes | 246 |
Total "Not Satisfied" Votes | 87 |