I'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run.
Details
The trick is figuring out if the user is inputting seconds or a combination of seconds and minutes. The ones and the tens places should be interpreted as seconds and the hundreds and thousands places should be minutes. For example, the value 1234
should be interpreted as 12 minutes, 34 seconds and 9876
should be 98 minutes, 76 seconds. Typing 130
and 90
should both result in a cook time of 90 seconds.
Here are a few other inputs and outputs:
- 1 = 1
- 11 = 11
- 111 = 71
- 1111 = 671
- 9 = 9
- 99 = 99
- 999 = 639
- 9999 = 6039
Rules
This is code-golf, so the shortest program in bytes wins. Standard loopholes are not allowed. The winning entry must return the right answer when given any integer input from 1 to 9999.
9876
? \$\endgroup\$190
? \$\endgroup\$