2022 年第四届河南省 CCPC 大学生程序设计竞赛 G

 

 

 

题目大意:都是中文自己看(恼——QAQ)

思路:其实就是一个纯纯骗人的题目,我们抓住题目要的答案,求每个人串按位与运算后得到1 的期望是多少。

那么根据按位与操作来说,如果这个位置有一个串为0就整个串的值为0,,然后对于题目给与的每次操作,变换后的串的结果要么变成0,要么是1(两个串的位置都是1),

但是无论是变换前后的字符串对最后按位与操作后的结果是一致的,因为变换前后对有0的位置的串不会改变0这个数,那么对最后的结果也不会改变。

所以结果就是原来的字符串中每一列全部为1的个数。

/**
*  ┏┓   ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃       ┃
* ┃   ━   ┃ ++ + + +
*  ████━████+
*  ◥██◤ ◥██◤ +
* ┃   ┻   ┃
* ┃       ┃ + +
* ┗━┓   ┏━┛
*   ┃   ┃ + + + +Code is far away from  
*   ┃   ┃ + bug with the animal protecting
*   ┃    ┗━━━┓ 神兽保佑,代码无bug 
*   ┃  	    ┣┓
*    ┃        ┏┛
*     ┗┓┓┏━┳┓┏┛ + + + +
*    ┃┫┫ ┃┫┫
*    ┗┻┛ ┗┻┛+ + + +
*/

#include<cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include<vector>
#include<queue>
#include<map>
#define ll long long 
using namespace std;

const int N=1000000+100;
int n ,m,h;
char s[1010][4040];


int main()
{
	cin>>n>>m;
	for(int i =1;i<=n;i++)	
	cin>>s[i]+1;
	int res=0;
	for(int i =1;i<=m;i++)
	{
		int p=1;
		for(int j =1;j<=n;j++)
		{
			if(s[j][i]=='0')p=0;
		}
		res+=p;
	}
	cout<<res<<endl;

	
	return 0;
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值