7-2 then points (15 points)

Sometimes it is represented by a four-digit time, such as 11:00 1106 represents 6 minutes. Now, your program should be calculated according to the start time and end time of the passage of time.

Reading two numbers, the first number indicates the current time in such a four-digit, the second digit represents the number of minutes, then calculate the current time is elapsed after a few minutes, the results also indicated as four digits. When the hour digits, no leading zero, i.e. 5.30 expressed as 530. Note that the second number indicates the number of minutes could exceed 60, it may be negative.

Input formats:

In the given input row two integers, namely, the start time of four digits, and the number of minutes elapsed, separated by a space therebetween. Note: At a starting time, when the single-digit hours, without leading zeros, i.e. 5.30 expressed as 530; the number may exceed 60 minutes elapsed, it could be negative.

Output formats:

End time output four digits. Topic ensure that the start time and end time on the same day.

Sample input:

1120 110

Sample output:

1310

#include <stdio.h>
 int main () {
     int T1, T2, h1 of, H2, M1, M2; 
    Scanf ( " % D% D " , & T1, & T2); // for receiving two time 
    h1 = t1 / 100 ; // h1 of hours 
    M1% T1 = 100 ; // M1 min 
    
    IF (T2> = 0 ) { // n 
        h1 of + h1 of = (M1 + T2) / 60 ; 
        M1 = (M1 + T2)% 60 ; 
    } 
    the else { // negative 
        int CON * = h1 of 60 + M1 + T2; 
        h1 of=con/60;
        m1=con%60;
    }
    printf("%d",h1*100+m1);
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/xly1997/p/11228768.html