51Nod 1095 Anigram单词
- 作者: 五速梦信息网
- 时间: 2026年04月04日 13:53
熟练使用map即可,不然用vector会超时
#include <iostream>
#include <cstring>
#include <string>
#include <map>
#include <algorithm> using namespace std;
map<string, int>q1, q2;
//string 为索引 int main(){
ios::sync_with_stdio(false);
int n, m;
cin >> n;
while (n--){
string s;
cin >> s;
q1[s]++;
sort(s.begin(), s.end());
q2[s]++;
}
cin >> m;
while (m--){
string s;
cin >> s;
int ans1 = q1[s];
sort(s.begin(), s.end());
int ans2 = q2[s];
cout << ans2 - ans1 << endl;
}
system("pause");
return ;
}
- 上一篇: 60天shell脚本计划
- 下一篇: 50个sql语句数据
相关文章
-
60天shell脚本计划
60天shell脚本计划
- 互联网
- 2026年04月04日
-
64位linux下安装ps模拟器ePSxe
64位linux下安装ps模拟器ePSxe
- 互联网
- 2026年04月04日
-
067.Python框架Django之DRF视图类
067.Python框架Django之DRF视图类
- 互联网
- 2026年04月04日
-
50个sql语句数据
50个sql语句数据
- 互联网
- 2026年04月04日
-
050 Android 百度地图的使用
050 Android 百度地图的使用
- 互联网
- 2026年04月04日
-
40个Java多线程问题总结
40个Java多线程问题总结
- 互联网
- 2026年04月04日






