文章

1

粉丝

162

获赞

0

访问

4.6k

头像
变位词-哈希表
P1032
发布于2022年2月27日 17:31
阅读数 4.6k

#include <iostream>
#include <cstring>
#include <algorithm>
#include <unordered_map>

using namespace std;


int main()
{
    int n;
    cin >> n;
    while (n -- )
    {
        string a,b;
        cin >> a >> b;
        unordered_map<char,int> map;
        for(auto item:a) map[item]++;
        int flag = 1;
        for(auto item:b)
        {
            if(!map[item])
            {
                flag = 0;
                break;
            }
            map[item]--;
        }
        if(fla...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发