标签:stream ring pac splay strcpy for space src clu
水题~
#include<iostream> #include<algorithm> #include<string.h> #define maxn 25 using namespace std; typedef long long ll; char s[maxn],ttime[10]; int maxh=0,maxm=0,maxs=0; int minh=23,minm=59,mins=59; int hr,me,sd; char lockid[maxn],unlockid[maxn]; int main() { int m; cin>>m; for(int i=0;i<m;i++) { cin>>s; cin>>ttime; hr=(ttime[0]-‘0‘)*10+(ttime[1]-‘0‘); me=(ttime[3]-‘0‘)*10+(ttime[4]-‘0‘); sd=(ttime[6]-‘0‘)*10+(ttime[7]-‘0‘); if(hr<minh) { minh=hr,minm=me,mins=sd; strcpy(unlockid,s); } else if(hr==minh) { if(me<minm) { minh=hr,minm=me,mins=sd; strcpy(unlockid,s); } else if(me==minm) { if(sd<mins) { minh=hr,minm=me,mins=sd; strcpy(unlockid,s); } } } cin>>ttime; hr=(ttime[0]-‘0‘)*10+(ttime[1]-‘0‘); me=(ttime[3]-‘0‘)*10+(ttime[4]-‘0‘); sd=(ttime[6]-‘0‘)*10+(ttime[7]-‘0‘); if(hr>maxh) { maxh=hr,maxm=me,maxs=sd; strcpy(lockid,s); } else if(hr==maxh) { if(me>maxm) { maxh=hr,maxm=me,maxs=sd; strcpy(lockid,s); } else if(me==maxm) { if(sd>maxs) { maxh=hr,maxm=me,maxs=sd; strcpy(lockid,s); } } } } cout<<unlockid<<" "<<lockid<<endl; }
标签:stream ring pac splay strcpy for space src clu
原文地址:https://www.cnblogs.com/FTA-Macro/p/10029123.html