fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define int long long
  4. #define f first
  5. #define s second
  6. #define file(a) freopen(a".inp","r",stdin);freopen(a".out","w",stdout);
  7. #define fastoi ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  8. #define maxn 20
  9. using namespace std;
  10. ll n,m;
  11. char a[maxn][maxn];
  12. void loang(ll x,ll y)
  13. {
  14. for (int i=1;i<=m;i++) a[x][i] = '*';
  15. for (int j=1;j<=n;j++) a[j][y] = '*';
  16. }
  17. int32_t main()
  18. {
  19. fastoi;
  20. //file("test");
  21. cin >> n >> m;
  22. for (int i=1;i<=n;i++)
  23. for (int j=1;j<=m;j++) cin >> a[i][j];
  24.  
  25. ll ans = 0;
  26. for (int i=1;i<=n;i++)
  27. {
  28. for (int j=1;j<=m;j++)
  29. {
  30. if (a[i][j] == '.')
  31. {
  32. ans++;
  33. loang(i,j);
  34. }
  35. }
  36. }
  37. cout << ans;
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
Standard output is empty