# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14398 | Time machine |
|
14412 | Roger says you are 2486 |
|
14417 | Holo the wise wolf |
|
Description
In the year 2486, elephants successfully invented a time machine. However, to prevent its misuse, the Time Police established a rule: It can only be used to travel to the past, and the destination must be less than 24 hours of the present time. The elephants ask for your help to test the time machine. You know the time before you were sent (now) and the time after you arrive (past). How long was the time interval between these two moments?
Input
The first line contains three integers, H1
, M1
, and S1
, representing the time before teleportation (now).
The second line contains three integers, H2
, M2
, and S2
, representing the time after teleportation (past).
0 ≤ H1
, H2
≤ 23
0 ≤ M1
, M2
≤ 59
0 ≤ S1
, S2
≤ 59
The time format is: HH MM SS
Output
Output a single line that contains three integer, represent the time interval between teleport.
Please follow the format: HH MM SS
, and also, the time should be in the range below.
0 ≤ HH
≤ 23
0 ≤ MM
≤ 59
0 ≤ SS
≤ 59
There should be NO space and '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Roger is a famous gaming streamer on Twitch. However, he is notorious for being too lazy to go on stream. One of his fan even records the time he streams each day, and he would like to implement a fuction which can tell how much time Roger streamed from day A to day B.
In order to help this crazy fan out, you have to design a program which can take in several time inrervals (from day A to day B) and calculate how much time Roger streamed in each time interval.
Input
The first line contains an integer N, represents the number of the days which the fan recorded.
The second line contains N integers, i-th number Hi represents the number of hours he streamed on day Hi.
The third line contains an integer M, represents the number of the intervals.
Next, there would be M lines, each line contains two integers A B, represents the starting day and the ending day of the interval. (Starting day A and ending day B are included in the interval.)
Input constraints: (You don't have to type the followings into your code, these are here to show you how large the data would be)
1 ≤ N, M ≤ 1000
0 ≤ Hi ≤ 24
1 ≤ A ≤ B ≤ N
Explanation:
Take sample input as an example:
The first line contains an integer 5, meaning there would be 5 days of records.
Next line contains 5 integers, which means Roger streamed for 2 hours on the first day, 3 hours on the second day, 0 hour on the third day, 7 hours on the fourth day, 5 hours on the fifth day.
The third line contains an integer 3, meaning there would be 3 time interval for queries.
Next, there are 3 lines, first line means from day 3 to day 5, second line means from day 2 to day 4, third line means from day 4 to day 4 (which means there is only on day in this time interval, and it is day 4).
Output
Output M lines, each line contain an integer represents the number of hours Roger streamed in that time interval.
There should be a '\n' at the end of each line.
Explanation:
Take sample ouput as an example:
We can get the answer of the first time interval by adding streaming hours of day 3, day 4 and day 5, which is 0, 7, 5 respectively, and the answer is 12.
We can get the answer of the second time interval by adding streaming hours of day 2, day 3 and day 4, which is 3, 0, 7 respectively, and the answer is 10.
We can get the answer of the third time interval by adding streaming hours of day 4, which is 7, and the answer is 7.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Lawrence and Holo were traveling merchants who went from town to town trading various goods in order to make a profit. However, Holo spent too much money on other things like clothes, shoes, oil, comb, and lots of apples! Hence, Lawrence was upset about this and told her to records all these expense. Holo can do the math without any difficulty, but she was too lazy to do it, so she ask for your help. Please design a program which can do simple addition like 2486+7414 or 1919810+114514.
Input
The first line contains a single string s, representing the mathematical expression with two numbers and an operator +.
The string only includes numbers from 0~9 and + operator which would only appears once.
The length of the string would not exceed 200 characters.
The digits of the two numbers would not exceed 100 characters, but it might be too big to store in long long.
Output
Output the answer of the mathematical expression.
Note that you do NOT need to print '\n' at the end of the output.