Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define fto(i, l, r) for (int i=l; i<=r; ++i)
- using namespace std;
- int r, c, ans = 0;
- char a[11][11];
- bool ate[11][11];
- int main() {
- #ifndef ONLINE_JUDGE
- freopen("P142PROH.inp", "r", stdin);
- #endif // ONLINE_JUDGE
- scanf("%d%d", &r, &c);
- fto(i, 0, r - 1)
- {
- fto(j, 0, c - 1) scanf("%c", &a[i][j]);
- char tmp; scanf("%c", &tmp);
- }
- memset(ate, false, sizeof ate);
- fto(i, 0, r - 1)
- {
- bool found = false;
- fto(j, 0, c - 1)
- if (a[i][j] == 'S')
- {
- found = true;
- break;
- }
- if (!found)
- {
- ans += c;
- fto(j, 0, c - 1) ate[i][j] = true;
- }
- }
- fto(j, 0, c - 1)
- {
- bool found = false;
- fto(i, 0, r - 1)
- if (a[i][j] == 'S')
- {
- found = true;
- break;
- }
- if (!found)
- fto(i, 0, r - 1)
- if (!ate[i][j]) ++ans;
- }
- printf("%d", ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment