Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <set>
- using namespace std;
- int main()
- {
- int n, m;
- cin >> n >> m;
- int ans = 0;
- vector<vector<char>> a(n, vector<char>(m));
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- {
- cin >> a[i][j];
- }
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- {
- if (a[i][j] == 'F')
- {
- for (int k = i; k < n; k++)
- {
- if (a[k][j] == '#')
- break;
- if (a[k][j] == 'M')
- {
- a[k][j] = '*';
- ans++;
- }
- }
- for (int k = i; k >= 0; k--)
- {
- if (a[k][j] == '#')
- break;
- if (a[k][j] == 'M')
- {
- a[k][j] = '*';
- ans++;
- }
- }
- for (int k = j; k < m; k++)
- {
- if (a[i][k] == '#')
- break;
- if (a[i][k] == 'M')
- {
- a[i][k] = '*';
- ans++;
- }
- }
- for (int k = j; k >= 0; k--)
- {
- if (a[i][k] == '#')
- break;
- if (a[i][k] == 'M')
- {
- a[i][k] = '*';
- ans++;
- }
- }
- }
- }
- vector <bool> lol(n, vector<bool>(m, false));
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement