2016-08-08 Problem Solving►UVa UVa 11677 - Alarm Clock Contents 1. Problem2. Solution3. Code Problem中文網址 Solution把時間都先轉成分鐘,再依兩者間的大小進行計算。 CodeUVa 11677123456789101112131415161718#include<cstdio>#define DAY 1440int main(){ int h1, h2, m1, m2; while (scanf("%d%d%d%d", &h1, &m1, &h2, &m2) && (h1 || h2 || m1 || m2)) { int n1 = h1 * 60 + m1, n2 = h2 * 60 + m2, sum; if (n1 <= n2) sum = n2 - n1; else sum = DAY - n1 + n2; printf("%d\n", sum); } return 0;} Newer UVa 11809 - Floating-Point Numbers Older UVa 694 - The Collatz Sequence