习题5-5 复合词(Compound Words, UVa 10391)
来源:互联网 发布:linux查系统版本 编辑:程序博客网 时间:2024/06/09 18:54
#include <iostream>#include <string>#include <vector>#include <stack>#include <queue>#include <deque>#include <set>#include <map>#include <algorithm>#include <sstream>#include <utility>#include <cstring>#include <cstdio>#include <cmath>#include <cctype>//#include "ChenHC.h"#define CLOSE() ios::sync_with_stdio(false)#define CLEAR(a, b) memset(a, b, sizeof(a))#define IN() freopen("in.txt", "r", stdin)#define OUT() freopen("out.txt", "w", stdout)const int maxn = 1e5 + 5;using LL = long long;using UI = unsigned int;using namespace std;//------------------------------------------------------------------------------------------////直接组合超时,改用拆分的思想就能过。set<string> word;int main() {string s;while (cin >> s) word.insert(s);int beg = 0;string s1, s2;for (auto i = word.begin(); i != word.end(); ++i) {for (int j = 0; j < (*i).size(); j++) {s1 = (*i).substr(0, j + 1);s2 = (*i).substr(j + 1);if (word.count(s1) && word.count(s2)) {cout << *i << endl;break;}}}return 0;}
阅读全文
0 0
- 习题5-5 复合词(Compound Words, UVa 10391)
- 5-5 UVA 10391 Compound Words复合词
- 复合词(Compound Words, UVa 10391)
- Compound Words(复合词) UVA 10391
- uva 10391复合词compound words(Trie+set)
- 算法竞赛入门经典 第二版 习题5-5 复合词 Compound Words uva10391
- uva 10391 Compound Words 习题5-5 (STL string、set练习)
- UVA10391: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基础学习(一)
- jpa学习和jpa与spring整合(二)
- shell进度条
- HIVE外部表到底损失多少性能
- python 的常用方法
- 习题5-5 复合词(Compound Words, UVa 10391)
- Nginx实现反向代理负载均衡
- According to the TLD or the tag file, attribute test is mandatory for tag if异常
- Codeforces 819 E. Mister B and Flight to the Moon
- 华为面试资料整理
- 文章标题
- php curl post请求丢失'+'问题
- Vue.js学习笔记-1-组件
- Hbase 行键设计(rowkey) 实现多条件查询