fork download
  1. #include<iostream>
  2. #include<math.h>
  3. #include<iomanip>
  4. #include <string>
  5. #include<algorithm>
  6. #include <vector>
  7. using namespace std;
  8.  
  9. void fast()
  10. {
  11. ios_base::sync_with_stdio(0);
  12. cin.tie(0);
  13. cout.tie(0);
  14. }
  15.  
  16. int main()
  17. {
  18. fast();
  19. int r, c;
  20. cin >> r >> c;
  21. char g[15][15];
  22.  
  23. int rows = 0;
  24. int colums = 0;
  25. for (int i = 0;i < r;i++) {
  26. for (int j = 0;j < c;j++) {
  27. cin >> g[i][j];
  28. }
  29. }
  30.  
  31. for (int i = 0;i < r;i++) {
  32. bool flag = true;
  33. for (int j = 0;j < c;j++) { //rows num
  34. if (g[i][j] == 'S') {
  35. flag = false;
  36. }
  37. }
  38. if (flag) {
  39. rows++;
  40. }
  41. }
  42.  
  43. for (int i = 0;i < c;i++) {
  44. bool flag = true;
  45. for (int j = 0;j < r;j++) { //colums num
  46. if (g[i][j] == 'S') {
  47. flag = false;
  48. }
  49. }
  50. if (flag) {
  51. colums++;
  52. }
  53. }
  54.  
  55. cout << ((rows*c)+(colums*r)) - colums;
  56.  
  57. return 0;
  58. }
  59.  
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty