CodeForces - 16D Logging【水题】

    科技2022-08-21  136

    题目链接:https://codeforces.com/contest/16/problem/D

    #include <iostream> #include <cstdio> #include <cstring> #include <string> using namespace std; string s; int n; int res,cnt; int main() { scanf("%d",&n); getchar(); int pre=-1; while(n--) { int h,m; char c; scanf("[%d:%d %c",&h,&m,&c); h%=12; getline(cin,s); if(c=='p') h+=12; if(h*60+m<pre) res++,cnt=1; else if(h*60+m==pre) { if(++cnt>10) res++,cnt=1; } else cnt=1; pre=h*60+m; } printf("%d\n",res+1); return 0; }
    Processed: 0.013, SQL: 10