标签:processor 地方 sam pre others problem limit ott float
(这也是没有的办法。缺水啊!!)
每一个小孩有一个时间段可以洗澡。而且,他们是可以一起洗的(无论你是男孩是女孩)。
那么。什么时间洗澡,谁应该来洗,由谁决定的呢?那必定是他们伟大的“澡”神啊。“澡”神有一个时间表。记录着该部落的小孩。什么时候段能够洗澡。如今,“澡”神要问你,一天内。他须要最少开启和关闭多少次洗澡的水龙头呢?由于,开启和关闭一次水龙头是很的费力气的,即便。这也是瞬间完毕的。
接下来n行。每行一个时间段。H1H1:M1M1-H2H2:M2M2。24小时制。
保证该时间段是在一天之内的。可是,不保证,H1H1:M1M1先于H2H2:M2M2。
1 00:12-12:12 2 00:12-12:12 14:00-12:00
1 1
跟NYOJ-891类似,区间找点
01.#include<iostream>02.#include<algorithm>03.using namespace std;04.struct node05.{06.int h1,h2,m1,m2;07.}b[110];08.bool cmp(node
a1,node a2)09.{10.return a1.h2<a2.h2;11.}12.int main()13.{14.int n;15.char c;16.while(cin>>n)17.{18.for(int i=0;i<n;i++)19.{20.cin>>b[i].h1>>c>>b[i].m1>>c>>b[i].h2>>c>>b[i].m2;21.b[i].h1=b[i].h1*100+b[i].m1;22.b[i].h2=b[i].h2*100+b[i].m2;23.if(b[i].h1>b[i].h2)24.swap(b[i].h1,b[i].h2);25.} 26.int sum=1;27.sort(b,b+n,cmp);28.for(int i=1;i<n;i++)29.{30.if(b[i].h1>b[i-1].h2)31.sum++;32.else 33.b[i].h2=min(b[i].h2,b[i-1].h2);34.}35.cout<<sum<<endl; 36.}37.return 0;38.}标签:processor 地方 sam pre others problem limit ott float
原文地址:http://www.cnblogs.com/jzdwajue/p/6906839.html