Codeforces 16D logging 水题

题目链接:http://codeforces.com/problemset/problem/16/D

水题呵呵。。

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define N 110
#define ll int
struct node{
	int h,m;
	int hehe;
}a[N];
int n;
char s[10000];
int main(){
	int i, j;
	while(~scanf("%d",&n)){
		getchar();
		for(i = 1; i <= n; i++){
			gets(s);
			a[i].h = (s[1]-'0')*10+s[2]-'0';
			a[i].m = (s[4]-'0')*10+s[5]-'0';
			if(a[i].h==12)a[i].h=0;
			if(s[7]=='p') {
				a[i].h+=12;			
			}			
			a[i].hehe = a[i].m + a[i].h*60;
		}
		int ans = 1, x = a[1].hehe;
		ll siz = 1;
		for(i = 2; i <= n; i++) {
			if(a[i].hehe<x)siz = 1, ans++;
			else if(a[i].hehe==x)siz++;
			else siz = 1;
			if(siz>10){siz = 1;ans++;}
			x = a[i].hehe;
		}
		printf("%d\n",ans);
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值