P3370字符串哈希
一、解题思路
哈希模板题,我用map解决了
二、代码实现
1 #include "bits/stdc++.h" 2 using namespace std; 3 map <string,int> ans; 4 string temp; 5 int cnt; 6 int main() 7 { 8 int n; 9 cin >> n; 10 for(int i = 1;i <= n;i++){ 11 cin >> temp; 12 if(!ans.count(temp)) 13 ans.insert(pair<string,int>(temp,1)); 14 else 15 cnt++; 16 } 17 cout << n - cnt; 18 return 0; 19 }
本文来自博客园,作者:{scanner},转载请注明原文链接:{https://home.cnblogs.com/u/scannerkk/}

浙公网安备 33010602011771号