标签:build uil \n code class ios name ret int
思路:统计n*m矩阵中1的个数。
#include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main(void) { int t; scanf("%d",&t); while(t--) { int n,m; scanf("%d%d",&n,&m); int a[n][m]; int count = 0; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) { scanf("%d",&a[i][j]); if(a[i][j]==1) count++; } printf("%d\n",count); } return 0; }
标签:build uil \n code class ios name ret int
原文地址:https://www.cnblogs.com/AC-AC/p/9742004.html