#include <iostream>
using namespace std;
int main()
{
//freopen("input.txt", "r", stdin);
for(int tc = 1; tc <= 10; tc++)
{
int n, a[100][100];
int cnt = 0;
cin >> n;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
//---------------------------
//duyet tung cot
for(int j = 0; j < n; j++)
{
bool check = false;
for(int i = 0; i < n; i++)
{
if(a[i][j] == 1)
check = true;
if(check == true && a[i][j] == 2)
{
cnt++;
check = false;
}
}
}
cout << "#" << tc << " " << cnt << endl;
}
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.