Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#include "/Users/the_sun/stdc++.h"
- #include <bits/stdc++.h>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- #define pub push_back
- #define pob pop_back
- #define F first
- #define S second
- #define PI acos(-1)
- typedef long long ll;
- const ll MAXN = 1e9 + 4;
- const ll MAXL = 1e18;
- const ll N = 1000;
- const double eps = 1e-11;
- vector<pair<int, int> > add({{1, 0}, {-1, 0}, {0, 1}, {0, -1}});
- int main() {
- int m, n;
- in >> n >> m;
- vector<vector<char> > v(n, vector<char> (m));
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < m; j++) {
- in >> v[i][j];
- }
- }
- int ans = 0;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < m; ++j) {
- //cout << i << " " << j << " : ";
- for (int k = 0; k < 4; ++k) {
- //cout << i + add[k].F << "," << j + add[k].S << " ";
- if (v[i][j] == '+' && v[i + add[k].F][j + add[k].S] == '-') {
- ans++;
- break;
- }
- }
- //cout << "\n";
- }
- }
- out << ans << "\n";
- return 0;
- }
- /*
- 7 8
- --------
- ---+++--
- ---+++--
- -+++++--
- -+++++--
- --++-+--
- --------
- 3 3
- ---
- -+-
- ---
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement