标签:des style blog color os io for art
1 #include"iostream" 2 #include"cstdio" 3 #include"cstring" 4 #include"algorithm" 5 using namespace std; 6 const int ms=1010; 7 const int lim=24*60; 8 int T,n,k,t,m; 9 int type[ms]; 10 int last[ms]; 11 void print(int time) 12 { 13 if(time>=lim) 14 time%=lim; 15 printf("%02d:%02d\n",time/60,time%60); 16 } 17 int main() 18 { 19 cin>>T; 20 while(T--) 21 { 22 cin>>n>>t>>k>>m; 23 memset(type,0,sizeof(type)); 24 int hh,mm,a,b; 25 int cur=0; 26 for(int i=0;i<m;i++) 27 { 28 scanf("%d:%d %d %d",&hh,&mm,&a,&b); 29 hh=hh*60+mm; 30 if(type[a]>=b&&last[a]>=hh) 31 { 32 type[a]-=b; 33 print(last[a]+t); 34 continue; 35 } 36 if(type[a]&&last[a]>=hh) 37 { 38 b-=type[a]; 39 } 40 int x=(b-1)/k+1; 41 cur=max(cur,hh)+t*x; 42 print(cur); 43 type[a]=x*k-b; 44 last[a]=cur-t; 45 } 46 if(T) 47 puts(""); 48 } 49 return 0; 50 }
TIANKENG’s rice shop,布布扣,bubuko.com
标签:des style blog color os io for art
原文地址:http://www.cnblogs.com/767355675hutaishi/p/3889944.html