C - Free Cash

Free Cash

Description

Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than he doesn’t want to wait and leaves the cafe immediately.
Valera is very greedy, so he wants to serve all n customers next day (and get more profit). However, for that he needs to ensure that at each moment of time the number of working cashes is no less than the number of clients in the cafe.
Help Valera count the minimum number of cashes to work at his cafe next day, so that they can serve all visitors.

Input

The first line contains a single integer n (1 ≤ n ≤ 105), that is the number of cafe visitors.
Each of the following n lines has two space-separated integers hi and mi (0 ≤ hi ≤ 23; 0 ≤ mi ≤ 59), representing the time when the i-th person comes into the cafe.
Note that the time is given in the chronological order. All time is given within one 24-hour period.

Output

Print a single integer — the minimum number of cashes, needed to serve all clients next day.

Examples

Input
4
8 0
8 10
8 10
8 45
Output
2
Input
3
0 12
10 11
22 22
Output
1

Note

In the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.
In the second sample all visitors will come in different times, so it will be enough one cash.

代码:
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

int main()
{
    int n,i,j;
    int max,temp;
    int arr[100001],brr[100001];
    max=1;temp=1;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>arr[i]>>brr[i];
    }
    for(i=0;i<n;i++){
        temp=1;
        for(j=i+1;j<n;j++){
            if(arr[j]==arr[i]&&brr[j]==brr[i])
                temp++;
            else
                break;
        }
        if(temp>max)
            max=temp;
        i=j-1;
    }
    cout<<max<<endl;
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C-Free是一款针对C语言初学者的集成开发环境(IDE),它提供了一系列工具和功能,以帮助开发者编写、编译和运行C语言程序。C-Free的使用教程可以分为以下几个步骤: 1. 下载和安装:首先,在官方网站上下载C-Free的安装包,选择下载C-Free 5.0专业版。完成下载后,运行安装包进行安装。 2. 创建新项目:打开C-Free后,点击菜单栏上的文件,选择新建。在弹出的对话框中,选择保存为demo.c文件。这样,你就可以开始编写C语言代码了。 3. 编写代码:在demo.c文件中,你可以使用C语言来编写程序。你可以使用C-Free提供的代码编辑器来输入代码,并且可以利用其丰富的代码补全和语法高亮功能来提高编码效率。 4. 编译和运行:完成代码编写后,点击C-Free的菜单栏上的构建,选择编译并运行。C-Free会自动进行代码的编译和链接,并将程序运行在集成的调试器中。你可以通过调试器来观察程序的执行过程和变量的值,以及进行断点调试等操作。 5. 调试和测试:如果你的程序出现了错误或者需要进行调试,你可以在C-Free的调试器中设置断点,逐行调试程序。同时,C-Free还提供了一些调试工具,如内存查看器、变量查看器等,以帮助你更好地定位和解决问题。 以上就是C-Free的使用教程的主要步骤,希望对你有所帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [C-free使用教程](https://download.csdn.net/download/u013087068/8768761)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [C语言基础入门:C-Free 5下载和安装详细教程](https://blog.csdn.net/MQ0522/article/details/124631377)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [C-Free使用教程](https://blog.csdn.net/IT_WEH_coder/article/details/122154795)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值