DMOPC '15 Contest 6 P2 - Tilt

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type

cheesecake is preparing to write some math tests. Since math does not come easily to cheesecake, he is also preparing for the worst: not getting perfect on each one. Whenever cheesecake botches a test, the experience emotionally tilts him — it throws him off his game. He has to write N tests, knowing that test i will tilt him by T_i degrees (naturally, tilt is mathematically represented in degrees).

Remembering the wise words of his math teacher, cheesecake recalls that once you tilt a full 360 degrees, you are back to normal — that is, a tilt of 360^\circ is equal to no (zero) tilt.

cheesecake would like to know just how disappointed he will feel after writing all his tests. To this end, he has asked you to determine his final tilt.

Input Specification

The first line of input will contain the integer N (1 \le N \le 100), the number of math tests cheesecake will write.
The next N lines of input will each contain the decimal tilt of a test, with line i representing T_i (0.0 \le T_i \le 10.0^{15}). Each decimal will be written with exactly six digits after the decimal point.

Output Specification

A single decimal value in the range [0, 360); cheesecake's tilt after writing all his tests. Answers will be considered correct if they are within an absolute or relative error less than or equal to 10^{-5}.

Sample Input


Sample Output



cheesecake was well prepared for his first test, but his second test had some tricky logarithms that tilted him by 361^\circ. This is equivalent to a tilt of 1^\circ.


  • 0
    gavin_chen  commented on May 9, 2022, 9:49 p.m.

    Can someone take a look at my code I don't really understand why it isn't working I'm guessing it has to do on the problems output specification but I am not sure

  • 0
    xiaowuc1  commented on Oct. 4, 2021, 5:26 a.m.

    The input specification for this problem was underspecified, so the statement has been updated to clarify the precision with which these decimals are expressed. The checker for this problem remains unmodified, in spite of the mismatch between the input precision of 10^{-6} and the output precision of 10^{-5}.

    One test case has been added and most unlocked solutions have been rejudged. After the migration to Java 17 completes, all remaining Java submissions will be rejudged.

  • 8
    Kirito  commented on July 26, 2016, 2:22 a.m.

    Using Turing tilts me by 399 gradians

    • 5
      d  commented on July 27, 2016, 2:31 a.m.

      I'm tilted 0 degrees.

      • 3
        Kirito  commented on July 27, 2016, 11:10 p.m. edited

        Reading your solution tilts me so hard I capsized.

        (As does this math format)