求找错!2MLE 4WA 4AC!

P1808 单词分类

STL大法好 ```cpp #include<iostream> #include<cstdio> #include<string> #include<map> #include<algorithm> using namespace std; int n; map<string,int> m; string s; int main() { scanf("%d",&n); while (n--) { cin>>s; sort(s.begin(),s.end()); m[s]; } printf("%d\n",m.size()); return 0; } 和上面的对比………… ```
by KonnyakuZeri @ 2017-07-20 10:53:51


数组开小点试试??
by weige233 @ 2017-08-10 20:09:58


```cpp #include <iostream> #include <string> #include <algorithm> using namespace std; string s[10005] = {}; int main() { int n; cin >> n; getline(cin, s[1]); for(int i = 1; i <= n; i++) { getline(cin, s[i]); sort(s[i].begin(), s[i].end()); } sort(s+1, s+n+1); int cnt = 1; for(int i = 2; i <= n; i++) { if(s[i] != s[i - 1]) { cnt++; } } cout << cnt << endl; return 0; } ```
by Wechis @ 2022-02-11 11:08:09


|