Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <vector>
  4. #include <string>
  5. #include <algorithm>
  6. #include <set>
  7. using namespace std;
  8. int main()
  9. {
  10. int n, m;
  11. cin >> n >> m;
  12. int ans = 0;
  13. vector<vector<char>> a(n, vector<char>(m));
  14. for (int i = 0; i < n; i++)
  15. for (int j = 0; j < m; j++)
  16. {
  17. cin >> a[i][j];
  18. }
  19. for (int i = 0; i < n; i++)
  20. for (int j = 0; j < m; j++)
  21. {
  22. if (a[i][j] == 'F')
  23. {
  24. for (int k = i; k < n; k++)
  25. {
  26. if (a[k][j] == '#')
  27. break;
  28. if (a[k][j] == 'M')
  29. {
  30. a[k][j] = '*';
  31. ans++;
  32. }
  33. }
  34. for (int k = i; k >= 0; k--)
  35. {
  36. if (a[k][j] == '#')
  37. break;
  38. if (a[k][j] == 'M')
  39. {
  40. a[k][j] = '*';
  41. ans++;
  42. }
  43. }
  44.  
  45. for (int k = j; k < m; k++)
  46. {
  47. if (a[i][k] == '#')
  48. break;
  49. if (a[i][k] == 'M')
  50. {
  51. a[i][k] = '*';
  52. ans++;
  53. }
  54. }
  55. for (int k = j; k >= 0; k--)
  56. {
  57. if (a[i][k] == '#')
  58. break;
  59. if (a[i][k] == 'M')
  60. {
  61. a[i][k] = '*';
  62. ans++;
  63. }
  64. }
  65. }
  66. }
  67. vector <bool> lol(n, vector<bool>(m, false));
  68.  
  69. system("pause");
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement