随笔—邀请赛前训— 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)) const int inf = 0x7fffffff; const int N=110; int win[N][2*N]; int state[N];Z int main() { int n,m; while(cin>>n>>m) { int cnt=0; for(int i=1; i<=n; i++) { for(int j=1; j<=2*m; j++) { scanf("%d",&win[i][j]); if(j%2 == 0){ if(win[i][j-1] == 1 || win[i][j] == 1){ cnt++; } } } } cout<<cnt<<endl; } return 0; }