Uva - 10391 - Compound Words
来源:互联网 发布:7月7日白银数据错误 编辑:程序博客网 时间:2024/05/21 10:45
用set,set.insert()插入后,查找即可
AC代码:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cctype>#include <cstring>#include <string>#include <sstream>#include <vector>#include <set>#include <map>#include <algorithm>#include <stack>#include <queue>using namespace std;set<string> dict;int main(){ios::sync_with_stdio(false);string s;while (cin >> s) {dict.insert(s);}for (set<string>::iterator it = dict.begin(); it != dict.end(); it++) {string t = *it;for (int i = 1; i < t.length(); i++) {if (dict.find(t.substr(0, i)) != dict.end() &&dict.find(t.substr(i, t.length() - i)) != dict.end()) {cout << t << endl;break;}}}return 0;}
0 0
- uva 10391 compound words
- UVa 10391 - Compound Words
- uva 10391 - Compound Words
- uva 10391 - Compound Words
- UVa 10391 - Compound Words
- UVa 10391 - Compound Words
- uva 10391 - Compound Words
- UVA 10391 Compound Words
- UVA 10391 - Compound Words
- Uva-10391-Compound Words
- UVa 10391 - Compound Words
- uva--10391 - Compound Words
- UVA 10391 Compound Words
- UVa:10391 Compound Words
- uva 10391 Compound Words
- UVa 10391 - Compound Words
- UVA 10391 Compound Words
- UVA 10391 - Compound Words
- java笔记07 面向对象
- 触摸屏驱动分析
- golang 学习
- cocos2d-x lua table数据存储
- Maven学习(三)- 使用Maven构建Web项目
- Uva - 10391 - Compound Words
- 关于php面向对象继承方面的几点总结
- java扫雷游戏源代码下载
- unity开发:TCP socket网络连接
- HTTP请求报文和HTTP响应报文
- Android Studio Error:Could not download artifact 'ecj.jar (org.eclipse.jdt.core.compiler:ecj:4.4.2)'
- ACM题集以及各种总结大全!
- Maven学习(四)- 使用Maven构建Web项目-测试
- Maven学习(五)- 使用Maven构建Struts2项目