Codeforces847G UniversityClasses

45 篇文章 0 订阅
40 篇文章 0 订阅

标签:模拟

 There are n student groups at the university.During the study day, each group can take no more than 7 classes. Seven time slots numberedfrom 1 to 7 are allocated for the classes.

Theschedule on Monday is known for each group, i. e. time slots when group willhave classes are known.

Your taskis to determine the minimum number of rooms needed to hold classes for allgroups on Monday. Note that one room can hold at most one group class in asingle time slot.

Input

The firstline contains a single integer n (1 ≤ n ≤ 1000) — the number ofgroups.

Each ofthe following n linescontains a sequence consisting of 7 zeroes andones — the schedule of classes on Monday for a group. If the symbol in aposition equals to1 then the group hasclass in the corresponding time slot. In the other case, the group has no classin the corresponding time slot.

Output

Printminimum number of rooms needed to hold all groups classes on Monday.

Example

Input

2
0101010
1010101

Output

1

Input

3
0101011
0011001
0110111

Output

3

Note

In thefirst example one room is enough. It will be occupied in each of the seven timeslot by the first group or by the second group.

In thesecond example three rooms is enough, because in the seventh time slot allthree groups have classes.

Code

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
 
int n,ans=0,s[20];
char ch;
int main()
{
   scanf("%d",&n);
   rep(i,1,n)
           rep(j,1,7){cin>>ch;s[j]+=ch-'0';}
   rep(i,1,7)ans=max(ans,s[i]);
   cout<<ans<<endl;
   return 0;
}



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值