热门号码

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
using std::vector;
using std::queue;
using std::map;
using std::sort;
int cmp(const void * x, const void * y) {
    //x < y
#define datatype int
    return (*((datatype *)(x))) > (*((datatype *)(y))) ? 1 : -1;
#undef datatype
}
map<long long, int> mp;
char str[15];
const int num[26] = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    int n, m, l;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%s", str);
        l = strlen(str);
        long long tmp = 0;
        for (int j = 0; j < l; j++) {
            tmp = tmp * 10 + num[str[j] - 'A'];
        }
        mp[tmp]++;
    }
    for (int i = 0; i < m; i++) {
        long long tmp;
        scanf("%lld", &tmp);
        printf("%d\n", mp[tmp]);
    }
    return 0;
}
View Code

相关文章: