A higher resolution is required to access the IDE
- 29
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Swatch Internet Time is a decimal time system introduced in 1998 by Swatch. It is a universal time, expressed as a number between 0 and 1000 named beats representing the time in Biel (UTC+01:00), prefixed by theYou are provided with a time and associated timezone, of the format HH
Step 1. You must obtain the Biel (UTC+01:00) local time from the original time and timezone.
Step 2. You must convert the resulting Biel local time to beats, using the following formula:
Step 3. You must round the result to two decimal places (using half-up rounding), and always present the two decimal digits, e.g.
As an example, let's try to convert
Step 1. We need to convert the time from UTC+05:30 to UTC+01:00. In order to do this, we need to remove 4:30 from the original time, which means we obtain
Step 2. We compute the number of beats, by computing
Step 3. We round the result to two decimal places using half-up rounding, which gives us
The expected result with this example is
Note: Beware of rounding! Your language likely does not use half-up rounding by default, but half-even a.k.a banker's rounding (C/C++, Python, Lua), half-down (JavaScript), and so on, and some tests require the correct rounding algorithm to be set!
Note: Forget about shenanigans such as leap seconds, daylight savings or any other timezone weirdness, stick to the steps presented above!
Input
First line: rawtime being the time with timezone relative to UTC.
Output
First line: Time in beats, of the format @ B. BB.
Constraints
length(rawtime) = 18
Example
Input
02:24:00 UTC+01:00
Output
@100.00
A higher resolution is required to access the IDE