Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool sea[1010][1010];
- int main()
- {
- int n,m;
- cin >> n >> m;
- string boi;
- int res = 0;
- for (int i = 0;i<n;i++)
- {
- cin >> boi;
- for (int j = 0;j<m;j++)
- {
- if (boi[j] == '1')
- {
- sea[i+1][j+1] = 1;
- int temp = sea[i][j+1] + sea[i+1][j];
- if (temp == 0)
- res++;
- if (temp == 2)
- if (sea[i][j] == 0)
- res--;
- }
- }
- }
- cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement