Skip to main content
Tweeted twitter.com/#!/StackCodeGolf/status/150537020731695104
Link added
Source Link
JiminP
  • 3.5k
  • 2
  • 25
  • 37

Task

Make a complete program or a function which calculates sum of all temperatures which, when written in CelsiusCelsius and FahrenheitFahrenheit scale, are anagramanagram of each other.

Description

For example, 275 degree Celsius = 527 degree Fahrenheit, and 527 is anagram of 275. Non-integer temperatures (either in degree Celsius or degree Fahrenheit) and temperatures colder than 0 degree Celsius (like -40C = -40F) will not be considered.

Input

Input is a temperature in format ([1-9][0-9]*)(C|F) (example: 42F = 42 degree Fahrenheit, 125C = 125 degree Celsius, ...).

The program should be able to handle temperature less than 1000000C.

Output

Output is sum of all temperatures less than the temperature given by input, which, when written in Celsius and Fahrenheit scale, are anagram (without leading zeroes) of each other. Output will be two integers separated by a space. The first one will be the sum in degree Celsius, and the second one will be the sum in degree Fahrenheit.

If there's no such temperature, return or output 0 0.

Example

  • Input : 42C
  • There's no such temperature
  • Output : 0 0
  • Input : 300C
  • There's one temperature : 275C = 527F
  • Output : 275 527
  • Input : 10000F
  • There're three temperatures : 275C = 527F, 2345C = 4253F, and 4685C = 8465F
  • Output : 7305 13245

Task

Make a complete program or a function which calculates sum of all temperatures which, when written in Celsius and Fahrenheit scale, are anagram of each other.

Description

For example, 275 degree Celsius = 527 degree Fahrenheit, and 527 is anagram of 275. Non-integer temperatures (either in degree Celsius or degree Fahrenheit) and temperatures colder than 0 degree Celsius (like -40C = -40F) will not be considered.

Input

Input is a temperature in format ([1-9][0-9]*)(C|F) (example: 42F = 42 degree Fahrenheit, 125C = 125 degree Celsius, ...).

The program should be able to handle temperature less than 1000000C.

Output

Output is sum of all temperatures less than the temperature given by input, which, when written in Celsius and Fahrenheit scale, are anagram (without leading zeroes) of each other. Output will be two integers separated by a space. The first one will be the sum in degree Celsius, and the second one will be the sum in degree Fahrenheit.

If there's no such temperature, return or output 0 0.

Example

  • Input : 42C
  • There's no such temperature
  • Output : 0 0
  • Input : 300C
  • There's one temperature : 275C = 527F
  • Output : 275 527
  • Input : 10000F
  • There're three temperatures : 275C = 527F, 2345C = 4253F, and 4685C = 8465F
  • Output : 7305 13245

Task

Make a complete program or a function which calculates sum of all temperatures which, when written in Celsius and Fahrenheit scale, are anagram of each other.

Description

For example, 275 degree Celsius = 527 degree Fahrenheit, and 527 is anagram of 275. Non-integer temperatures (either in degree Celsius or degree Fahrenheit) and temperatures colder than 0 degree Celsius (like -40C = -40F) will not be considered.

Input

Input is a temperature in format ([1-9][0-9]*)(C|F) (example: 42F = 42 degree Fahrenheit, 125C = 125 degree Celsius, ...).

The program should be able to handle temperature less than 1000000C.

Output

Output is sum of all temperatures less than the temperature given by input, which, when written in Celsius and Fahrenheit scale, are anagram (without leading zeroes) of each other. Output will be two integers separated by a space. The first one will be the sum in degree Celsius, and the second one will be the sum in degree Fahrenheit.

If there's no such temperature, return or output 0 0.

Example

  • Input : 42C
  • There's no such temperature
  • Output : 0 0
  • Input : 300C
  • There's one temperature : 275C = 527F
  • Output : 275 527
  • Input : 10000F
  • There're three temperatures : 275C = 527F, 2345C = 4253F, and 4685C = 8465F
  • Output : 7305 13245
Source Link
JiminP
  • 3.5k
  • 2
  • 25
  • 37

Celsius - Fahrenheit anagram

Task

Make a complete program or a function which calculates sum of all temperatures which, when written in Celsius and Fahrenheit scale, are anagram of each other.

Description

For example, 275 degree Celsius = 527 degree Fahrenheit, and 527 is anagram of 275. Non-integer temperatures (either in degree Celsius or degree Fahrenheit) and temperatures colder than 0 degree Celsius (like -40C = -40F) will not be considered.

Input

Input is a temperature in format ([1-9][0-9]*)(C|F) (example: 42F = 42 degree Fahrenheit, 125C = 125 degree Celsius, ...).

The program should be able to handle temperature less than 1000000C.

Output

Output is sum of all temperatures less than the temperature given by input, which, when written in Celsius and Fahrenheit scale, are anagram (without leading zeroes) of each other. Output will be two integers separated by a space. The first one will be the sum in degree Celsius, and the second one will be the sum in degree Fahrenheit.

If there's no such temperature, return or output 0 0.

Example

  • Input : 42C
  • There's no such temperature
  • Output : 0 0
  • Input : 300C
  • There's one temperature : 275C = 527F
  • Output : 275 527
  • Input : 10000F
  • There're three temperatures : 275C = 527F, 2345C = 4253F, and 4685C = 8465F
  • Output : 7305 13245