Skip to main content
4 of 4
Removed potentially confusing test case
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Un-average temperatures!

There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur).

So, now the issue is, most people don't use this system. So, I need a program to convert back from this average!

Challenge

Given the average of the Celsius, Fahrenheit, Kelvin, and Rankine representations of a certain temperature, output the individual standard representations, in any prespecified and consistent order. It turns out that this is possible, based on my whiteboard calculations. Input will be a single floating-point value in whatever range your language can handle, and output will be four floating-point values in any reasonable format. You can restrict the input to force the output to be in the range of your language, but you must be able to support down to Absolute Zero (thus, you need to be able to handle negative numbers).

Test Cases

input -> (Celsius, Fahrenheit, Kelvin, Rankine)
100 -> (-70.86071428571424, -95.54928571428565, 202.28928571428574, 364.12071428571437)
20 -> (-128.0035714285714, -198.4064285714286, 145.14642857142857, 261.2635714285714)
-10 -> (-149.43214285714282, -236.97785714285715, 123.71785714285716, 222.69214285714287)
10000 -> (7000.567857142858, 12633.022142857144, 7273.717857142858, 13092.692142857144)

These values were generated with Uriel's Python program, and I verified that they were correct.

user42649
  • 42.6k
  • 5
  • 68
  • 224