给出一个N*M的字符矩阵 再给出P行字符
题目上说P行中必定存在与矩阵中。。直接统计矩阵中字符个数
然后减去P行的字符,然后输出剩下的字符(按照字典树)
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <climits>
- #include <cctype>
- #include <cmath>
- #include <string>
- #include <sstream>
- #include <iostream>
- #include <algorithm>
- #include <iomanip>
- using namespace std;
- #include <queue>
- #include <stack>
- #include <vector>
- #include <deque>
- #include <set>
- #include <map>
- typedef long long LL;
- #pragma comment(linker, "/STACK:1024000000,1024000000")
- #define pi acos(-1.0)
- #define lson l, m, rt<<1
- #define rson m+1, r, rt<<1|1
- typedef pair<int, int> PI;
- typedef pair<int, PI> PP;
- #ifdef _WIN32
- #define LLD "%I64d"
- #else
- #define LLD "%lld"
- #endif
- //LL quick(LL a, LL b){LL ans=1;while(b){if(b & 1)ans*=a;a=a*a;b>>=1;}return ans;}
- //inline int read(){char ch=' ';int ans=0;while(ch<'0' || ch>'9')ch=getchar();while(ch<='9' && ch>='0'){ans=ans*10+ch-'0';ch=getchar();}return ans;}
- //inline void print(LL x){printf(LLD, x);puts("");}
- //inline void read(int &x){char c = getchar();while(c < '0') c = getchar();x = c - '0'; c = getchar();while(c >= '0'){x = x * 10 + (c - '0'); c = getchar();}}
- int orz[30];
- char s[441];
- int main()
- {
- int n,m,t;
- #ifndef ONLINE_JUDGE
- freopen("in.txt", "r", stdin);
- freopen("out.txt", "w", stdout);
- #endif
- while(scanf("%d%d%d",&n,&m,&t)!=EOF)
- {
- memset(orz,0,sizeof(orz));
- for(int i=0;i<n;i++)
- {
- scanf("%s",s);
- for(int j=0;j<m;j++)
- orz[s[j]-'A']++;
- }
- for(int i=0;i<t;i++)
- {
- scanf("%s",s);
- int len=strlen(s);
- for(int j=0;j<len;j++)
- orz[s[j]-'A']--;
- }
- for(int i=0;i<26;i++)
- {
- if(orz[i]>0)
- while(orz[i]--)
- printf("%c",'A'+i);
- }
- printf("\n");
- }
- return 0;
- }