当前位置:网站首页>Solving for the number of mines
Solving for the number of mines
2022-08-10 01:47:00 【-JMY-】
题目描述
In order to ensure that important military bases on the border will not be invaded by the enemy,Our army was buried on the way the enemy army must passx颗地雷,known this
The place to go isn * msquare shape,To let our friendly forces know where there are mines,Our military engineers drew one
Mine distribution map.in this distribution,If there are no mines at a certain point,Then the sum of the bits of the number marked by this point will be one
个偶数;Conversely, if the point has a mine,The sum of the bits of the number marked by this point is an odd number.
Please program it out,How many mines have been planted in the area in total.
比如:There is one below5 * 6mine distribution map,The areas in which the mines are buried are marked with a grey background,shared in this area
10颗地雷.
12 | 35 | 90 | 21 | 1 | 9 |
91 | 3892 | 8749 | 342 | 3421 | 89 |
1881 | 1111 | 39 | 4 | 1 | 34 |
9 | 93 | 34 | 12 | 45 | 0 |
67 | 4 | 34 | 19 | 235 | 32 |
输入
接下来n行,每行有m个整数,The number of markers representing whether there are mines(These numbers are all marked<=9999的整数)
输出
样例输入
5 6 12 35 90 21 1 9 91 3892 8749 342 3421 89 1881 1111 39 4 1 34 9 93 34 12 45 0 67 4 34 19 235 32
样例输出
16
参考代码:
#include<bits/stdc++.h>
using namespace std;
int n,m,a[105][105],s;
int f(int x){
int k=0;
while(x!=0){
k+=x%10;
x/=10;
}
return k%2;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++){
scanf("%d",&a[i][j]);
if(f(a[i][j])==1)
s++;
}
printf("%d",s);
return 0;
}
边栏推荐
- PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明
- Docker interview question 2--get the number of database connections and docker-compose
- -Chess game-
- 【obs】obsqsv11 硬编 及与metartc codec对比
- c语言结构体、函数以及指针练习(简单通讯录)
- 断开和服务器共享连接的方法「建议收藏」
- Web性能测试模型小结
- 7. type( )函数——查询数据类型
- 你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
- -Knight Parade-
猜你喜欢
Next.js获取路由参数及styled-jsx 的使用
Mysql database ALTER basic operations
Leetcode79. 单词搜索
Biotin-Cy2 Conjugate, Biotin-Cy2 Conjugate_Cy2 Biotin Conjugate
重估HR SaaS:一体化后的新三年
Win7怎么把控制面板添加到右键菜单
Creo5.0入门教程赠素材
Redis 非关系型数据库学习(一) ---- Redis 的安装
PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明
labelme标注的json标签转txt格式
随机推荐
[SSH]如何敲一条线
02| operator
The technical aspects of the byte have been passed, and the salary has been negotiated for 20K*13, but the result is still being brushed. I asked the HR why...
【obs】obsqsv11 硬编 及与metartc codec对比
[NCTF2019]True XML cookbook-1|XXE漏洞
线程的同步与互斥
算法---整数替换(Kotlin)
Stanford CS143 Speed Pass PA1 Tutorial
Leetcode79. 单词搜索
router路由
D-Biotinol Involved by Biotin, CAS No: 53906-36-8 Specific Properties Description
[obs] obsqsv11 hard coding and comparison with metartc codec
deepstream学习笔记(三):deepstream-imagedata-multistream解析与接入适配yolov5模型测试
Minimum number of steps to get out of the maze 2
JVM Memory and Garbage Collection - 10. Direct Memory
基于ABP的AppUser对象扩展
LeetCode常见题型——链表
Solidity 智能合约入门
Kubernetes YAML编写 讲解
输入的这些数是否对称