题目:http://acm.hdu.edu.cn/showproblem.php?pid=4509
1 15:36 18:40 4 01:35 10:36 04:54 22:36 10:18 18:40 11:47 17:53
1256 179
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cstdio> using namespace std; const int maxtime=1440; int num[maxtime+1]; int main() { int n; while(scanf("%d",&n)!=EOF) { int left,right; int ans=0; memset(num,0,sizeof(num)); for(int i=0;i<n;i++) { int a,b,c,d; scanf("%d",&a); cin.get(); scanf("%d %d",&b,&c); cin.get(); scanf("%d",&d); left=a*60+b; right=c*60+d; for(int i=left;i<=right-1;i++) num[i]=1; } for(int i=0;i<maxtime+1;i++) { if(num[i]==0)continue; ans++; } cout<<maxtime-ans<<endl; } return 0; }