Codeforces Round #309 (Div. 2) B. Ohana Cleans Up 字符串水题
B. Ohana Cleans Up
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/554/problem/B
Description
Return the maximum number of rows that she can make completely clean.
Input
The first line of input will be a single integer n (1 ≤ n ≤ 100).
The next n lines will describe the state of the room. The i-th line will contain a binary string with n characters denoting the state of the i-th row of the room. The j-th character on this line is '1' if the j-th square in the i-th row is clean, and '0' if it is dirty.
Output
The output should be a single line containing an integer equal to a maximum possible number of rows that are completely clean.
Sample Input
4
0101
1000
1111
0101
Sample Output
2
HINT
题意
有一个n*n的房间,干净为1,脏为0
然后每次可以打扫一列,使得干净的变成肮脏,肮脏的变干净
问你最多使多少行全部变干净
题解:
如果要让打扫后,有两行同时变干净的话,那么这两行是一样的才行
所以直接判每一行的字符串出现了多少次,然后输出最多次数就好了
代码
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
//const int inf=0x7fffffff; //нчоч╢С
const int inf=0x3f3f3f3f;
/* inline void P(int x)
{
Num=0;if(!x){putchar('0');puts("");return;}
while(x>0)CH[++Num]=x%10,x/=10;
while(Num)putchar(CH[Num--]+48);
puts("");
}
*/
inline ll read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** int n;
string s[];
map<string,int>H;
int main()
{
n=read();
int ans=;
for(int i=;i<n;i++)
{
cin>>s[i];
H[s[i]]++;
ans=max(ans,H[s[i]]);
}
cout<<ans<<endl; }
Codeforces Round #309 (Div. 2) B. Ohana Cleans Up 字符串水题的更多相关文章
- Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks 字符串水题
A. Kyoya and Photobooks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- 贪心 Codeforces Round #309 (Div. 2) B. Ohana Cleans Up
题目传送门 /* 题意:某几列的数字翻转,使得某些行全为1,求出最多能有几行 想了好久都没有思路,看了代码才知道不用蠢办法,匹配初始相同的行最多能有几对就好了,不必翻转 */ #include < ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题
C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just re ...
- Codeforces Round #185 (Div. 2) A. Whose sentence is it? 水题
A. Whose sentence is it? Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...
- Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题
A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...
- Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题
A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...
- Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题
B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...
- Codeforces Round #310 (Div. 2) B. Case of Fake Numbers 水题
B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
随机推荐
- echart图表控件配置入门(一)
现在主流的web图表控件主要有hightchart.fusionchart.echart: echart作为百度前端部门近期推出的一个基于html5的免费图表控件,以其丰富图表类型和良好的兼容性速度得 ...
- struts2传递List对象(复合对象)
1.前台jsp界面: <%@ page language="java" contentType="text/html; charset=utf-8" pa ...
- centos 7搭建vpn(pptpd)服务器 (只限centos 7)
第一步:首先检查ppp是否开启 若使用XEN构架的VPS,此步骤不用执行 终端输入命令:cat /dev/ppp 开启成功的标志:No such file or directory 或者 No su ...
- iOS开发-你真的会用SDWebImage?(转发)
原文地址: http://www.jianshu.com/p/dabc0c6d083e SDWebImage作为目前最受欢迎的图片下载第三方框架,使用率很高.但是你真的会用吗?本文接下来将通过例子分析 ...
- mysql cluster 名词概念解读
Node Group [number_of_node_groups] = number_of_data_nodes / NoOfReplicas Partition When using ndbd, ...
- var隐式类型
var dogName = "ruiky"; 1.[编译器]会在编译时自动根据值的类型推断这个变量的类型: 2.变量类型不可更改:因为声明的时候已经确定类型了. 3.可 ...
- express 学习笔记
首先把这个库加载下来 npm install -g express 这样会安装它所有依赖包,这个非常恐怖.这个框架要依赖这么多外来的东西,如果有一个不与时俱进就会拖累整个框架的质量. C:\windo ...
- Collection Operators
[Collection Operators] Collection operators are specialized key paths that are passed as the paramet ...
- vim显示历史命令
[vim显示历史命令] q: 进入命令历史编辑.类似的还有 q/ 可以进入搜索历史编辑.注意 q 后面如果跟随其它字母,是进入命令记录. 可以像编辑缓冲区一样编辑某个命令,然后回车执行.也可以用 ct ...
- enumerate
enumerate 函数用于遍历序列中的元素并分配一个序号(序号默认从零开始 可以制定任意值): >>> for i,j in enumerate(('a','b','c')): p ...