WC '17 Contest 1 J2 - How's the Weather?

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 16M
C# 32M

Author:
Problem type
Woburn Challenge 2017-18 Round 1 - Junior Division

"Ugh, It's been so hot out lately, why does it have to be 32 degrees…"
"32 degrees? That's freezing!"

You've had quite enough of confusing conversations with Americans who assume you're using Fahrenheit when Celsius is clearly the way to go. Rather than argue with them, you've settled for writing a program to conveniently convert temperatures measured in degrees Celsius to Fahrenheit instead.

You came across the following formula, which holds true given that F is a temperature in degrees Fahrenheit while C is that same temperature in degrees Celsius:

\displaystyle C = \frac 5 9 \times (F - 32)

Given a value of C, which is an integer between -40 and 40 (inclusive), determine the corresponding value of F, so that you can express the equivalent temperature in degrees Fahrenheit for the Americans' benefit.

It's guaranteed that C will be chosen such that F will come out to exactly an integer, but you may output it with 0 or more digits after the decimal point.

Input Specification

The first and only line of input consists of a single integer, C.

Output Specification

Output a single integer, the temperature in degrees Fahrenheit which is equivalent to C degrees Celsius.

Sample Input

20

Sample Output

68

Comments


  • 3
    RMC_1231  commented on Nov. 5, 2022, 2:02 a.m.

    I feel a lot better knowing other people also struggle with basic math, lol


  • 2
    suryansh  commented on Aug. 4, 2022, 12:21 p.m.

    That was a nice problem.


  • 1
    yashdeep  commented on June 2, 2022, 5:35 a.m.

    F = \frac{9}{5} C + 32


  • -1
    Roni_DS  commented on April 24, 2022, 1:25 p.m.

    It worked for me with this formula:

    F = (C*1.8)+32

    Although quite simple, this is the first code that I write alone and it works


  • 1
    JustChaz  commented on March 10, 2022, 9:03 a.m. edited

    Dont have to do all the MATH on your own, thats what the program you create is for. BUT Keep in mind, You need to remember Math Formulas and Methods to Isolate the Unknown Variable. Im not giving Code, so hopefully this isn't giving too much help. Get F alone in the Above formula.

    • C = 5/9 x (F - 32)
    • C / 5/9 = (F - 32)
    • C / 5/9 + 32 = F

    Hope this directs some of ya a little.

    This took me a good minute, had to dig deep in the Math memory from School.


  • 3
    random_guy33  commented on Oct. 31, 2021, 2:38 a.m.

    the formula was not easy to figure out until i googled it.


  • 21
    Lulu_likes  commented on Sept. 9, 2021, 11:53 a.m.

    my first ever code , damn I feel stupid cause it took me so long. Finally though I got it right.....bravo me.


    • 6
      AnirudhBV  commented on Dec. 3, 2021, 12:08 a.m.

      Congrats dude