icpc:problems:luogup1808
problems | |
---|---|
名称 | 单词分类 |
题目编号 | P1808 |
题目链接 | luogu.com.cn/… |
来源 | Luogu |
算法分类 | 入门_字符串 |
难易程度 | 容易 |
单词分类
想法
对字符串内部排序,对字符串外部排序,依次判断是否有相同的,有相同的类型就减少。
代码实现
#include<string> #include<iostream> #include<algorithm> using namespace std; int main() { int T; string str[10010]; cin >> T; for(int i=1; i<=T; i++) { cin >> str[i]; sort(str[i].begin(), str[i].end()); } sort(str+1, str+1+T); int ans = T; for(int i=1; i<T; i++) { if(str[i] == str[i+1]) ans--; } cout << ans; return 0; }
/app/www/public/data/pages/icpc/problems/luogup1808.txt · 最后更改: 2024/03/13 15:13 由 温婕莺