AcWing 1776. 牛的基因组学
原题链接
简单
核心:哈希表怎么写
#include <bits/stdc++.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#define IO (ios::sync_with_stdio(false),cin.tie(0),cout.tie(0))
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=a;i>=n;i--)
#define fors(i,a,b) for(int i = a; i < b; ++i)
#define debug(x) cerr<<#x<<" = "<<x<<endl
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod = 1e9+7;
const int N = 1e2+10;
ll res, ans, cnt;
int n, m;
string a[N], b[N];
int main()
{
cin >> n >> m;
fors(i, 0, n) cin >> a[i];
fors(i, 0, n) cin >> b[i];
string gins = "ACGT";
int res = 0;
for (int i = 0; i < m; i ++ )
{
bool hash[4] = {};
for (int j = 0; j < n; j ++ )
hash[gins.find(a[j][i])] = true;
bool flag = true;
for (int j = 0; j < n; j ++ )
if (hash[gins.find(b[j][i])])
flag = false;
if (flag) res ++ ;
}
cout << res;
return 0;
}