CodeForces 595A Vitaly and Night

水题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int a[300][300];
int n,m,ans;

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=2*m;j++)
            scanf("%d",&a[i][j]);
    ans=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(a[i][2*j-1]+a[i][2*j]!=0) ans++;
    printf("%d\n",ans);
    return 0;
}
时间: 2024-10-18 01:51:46

CodeForces 595A Vitaly and Night的相关文章

CodeForces 595A

题意:有n层楼,每层楼有m户人家,每户人家有2个窗户 ,Vitaly通过窗户可以看到房间的灯是否打开,1表示打开,0表示关闭,如果有一个灯是打开的,表示该户人家还没睡觉,输出有多少户人家没睡. 题解:定a,b为某户人家灯亮情况,如果(a|b)=1,则表示该户人家没睡,输入边判断边统计就行. #include <iostream> #include <cstdio> using namespace std; int main() { int n,m; scanf("%d%d

CodeForces 518A Vitaly and Strings (水题,字符串)

题意:给定两个相同长度的字符串,让你找出一个字符串,字典序在两都之间. 析:这个题当时WA了好多次,后来才发现是这么水,我们只要把 s 串加上,然后和算数一样,该进位进位,然后再和 t 比较就行. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <set> #include <cstring> #in

codeforces 557D Vitaly and Cycle

题意简述 给定一个图 求至少添加多少条边使得它存在奇环 并求出添加的方案数 (注意不考虑自环) ----------------------------------------------------------------------------- 一道二分图染色的讨论题 比赛时只会用二分图染色判断树以及偶环 忘记用这个来判奇环... 二分图染色这种联赛知识点的题目现在也不会写了... ------------------------------------------------------

随笔—邀请赛前训— Codeforces Round #330 (Div. 2) Vitaly and Night

题意:给你很多对数,要么是0要么是1.不全0则ans++. 思路即题意. #include<cstdio> #include<cstring> #include<iostream> using namespace std; #define MAX(x,y) (((x)>(y)) ? (x) : (y)) #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define ABS(x) ((x)>0?(x):-(x))

Codeforces Round #311 (Div. 2) D. Vitaly and Cycle(二分图染色,奇环)

给定n个点,m条边. 求最少最要加几条边使图中存在奇环,且输出此时加边的方法种数 根据题意,只可能为 0:已经存在奇环,dfs搜到已经染色的且颜色相同 1:判断每个连通块里的 染色黑白色的个数 2 :某个点的 度 > 1 3:0条边 1 #include<cstdio> 2 #include<iostream> 3 #include<queue> 4 #include<vector> 5 #include<stack> 6 #include

CodeForces 300C 最短路

A Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 300C Description Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal

codeforces A. Array题解

Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the first set is less than zero (?<?0). The product of all numbers in the secon

CodeForces 300C --数论

A - A Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 300C Description Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the deci

Codeforces Round #297 (Div. 2) (ABCDE题解)

比赛链接:http://codeforces.com/contest/525 算是比较简单的一场了,拖了好久现在才补 A. Vitaliy and Pie time limit per test:2 seconds memory limit per test:256 megabytes After a hard day Vitaly got very hungry and he wants to eat his favorite potato pie. But it's not that sim