816A.md (1686B)
1 Source: https://codeforces.com/problemset/problem/816/A 2 3 A. Karen and Morning 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 512 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Karen is getting ready for a new school day! 22 23  24 25 It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. 26 27 What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome? 28 29 Remember that a palindrome is a string that reads the same forwards and backwards. For instance, 05:39 is not a palindrome, because 05:39 backwards is 93:50. On the other hand, 05:50 is a palindrome, because 05:50 backwards is 05:50. 30 31 Input 32 33 The first and only line of input contains a single string in the format hh:mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59). 34 35 Output 36 37 Output a single integer on a line by itself, the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome. 38 39 Examples 40 41 Input 42 43 ``` 44 05:39 45 ``` 46 47 Output 48 49 ``` 50 11 51 ``` 52 53 Input 54 55 ``` 56 13:31 57 ``` 58 59 Output 60 61 ``` 62 0 63 ``` 64 65 Input 66 67 ``` 68 23:59 69 ``` 70 71 Output 72 73 ``` 74 1 75 ``` 76 77 Note 78 79 In the first test case, the minimum number of minutes Karen should sleep for is 11. She can wake up at 05:50, when the time is a palindrome. 80 81 In the second test case, Karen can wake up immediately, as the current time, 13:31, is already a palindrome. 82 83 In the third test case, the minimum number of minutes Karen should sleep for is 1 minute. She can wake up at 00:00, when the time is a palindrome.