Topic links
Test Instructions: There are multiple windows on one interface, and the number of windows that are not covered by other windows.
Ideas: Direct violence enumerates the length and width of each window to determine if the lower-right corner is the same as the upper-left corner, and if the same again determines whether the inside of the rectangle is not covered by another window, note that the border overlay is also counted as overwritten.
code:
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm>using namespace std;const int MAXN = 105;char g[maxn][maxn];int N, M, vis[30];int judge (int x1, int y1, int x2, int y2) {for (int i = X1; I <= x2; i++) {for (int j = y1; j <= Y2; j + +) {if (Isupper (G[i][j])) {if (g[i][j]! = G[x1][y 1]) return 0; }}} return 1;} void Solve () {for (int i = 0, i < n; i++) {for (int j = 0; J < m; J + +) {if (Isupper (G[i][j]) ) {int a = J, b = i; while (G[i][a + 1] = = G[i][j]) {a++; } while (G[b + 1][j] = = G[i][j]) {b++; } if (B-i < 2 | | A-j < 2) continue; if (g[b][a] = = G[i][j] && judge (I, J, B, a)) vis[g[i][j]-' a '] = 1; } }}}int Main () {while (scanf ("%d%d", &n, &m) && n && m) {memset (Vis, 0, sizeof (VIS)); for (int i = 0; i < n; i++) scanf ("%s", G[i]);; Solve (); for (int i = 0; i < i++) if (Vis[i]) printf ("%c", i + ' A '); printf ("\ n"); } return 0;}