标签:des style color java os io strong for ar
a ahat hat hatword hziee word
ahat hatword字典树专题的题,用set水过去的。。题意:给一堆字符串,把其中可以由其他两个字符串连接起来的字符串输出。#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cctype> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <set> #include <map> #include <list> using namespace std; const int INF=1<<27; const int maxn=5100; int main() { ios::sync_with_stdio(false); string x,a,b; set <string> s; while(cin>>x) s.insert(x); set <string>::iterator it=s.begin(); while(it!=s.end()){ x=*it;int n=x.size(); for(int i=0;i<n;i++) { a.assign(x,0,i+1); b.assign(x,i+1,n-i-1); if(s.count(a)&&s.count(b)) {cout<<x<<endl;break;} } ++it; } return 0; }
标签:des style color java os io strong for ar
原文地址:http://blog.csdn.net/qq_16255321/article/details/38757691