您的位置:首页 > 其它

Codeforces Round #330 (Div. 2) A. Vitaly and Night(模拟)

2015-11-09 06:32 399 查看
题目链接

题意:一个有n层的楼。 每一层有m户人家,每户人家有2个窗子,告诉你每个窗子的是否亮着,只要有一个亮着就算着户人家没睡觉,问你没睡觉的户数。

解法:直接模拟统计

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define X first
#define Y second
#define cl(a,b) memset(a,b,sizeof(a))
typedef pair<int,int> P;
const int maxn=30005;
const int inf=1<<27;

int main(){
int n,m;
scanf("%d%d",&n,&m);
int ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m*2;j+=2){
int x,y;
cin>>x>>y;
if(x||y)ans++;
}
}
cout<<ans<<endl;
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: