You are viewing a single comment's thread. Return to all comments →
My solution in plain C
#include <stdio.h> int lagDuration(int h1, int m1, int h2, int m2, int k); int lagDuration(int h1, int m1, int h2, int m2, int k) { int lag, t1, t2; t1 = (h1 + k) * 60 + m1; t2 = h2 * 60 + m2; lag = t1 - t2; return lag; } int main(void) { int n, index, h1, m1, h2, m2, k, lag; scanf("%d", &n); for (index = 0; index < n; index += 1) { scanf("%d %d %d %d", &h1, &m1, &h2, &m2); scanf("%d", &k); lag = lagDuration(h1, m1, h2, m2, k); printf("%d\n", lag); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Clock Delay
You are viewing a single comment's thread. Return to all comments →
My solution in plain C