标签:art pac ++ ios color eid div tar ring
解题报告
题意:
思路:
map暴力。
#include <iostream> #include <cstring> #include <cstdio> #include <map> using namespace std; int main() { string str,ch; int i,j; while(cin>>str) { map<string,int>Map; if(str[0]==‘*‘) break; int f=0; if(str.length()<=2){ cout<<str<<" is surprising."<<endl; } else { for(i=0;i<=str.length()-2;i++) { Map.clear(); for(j=0;j<str.length()-i-1;j++) { ch.clear(); ch+=str[j]; ch+=str[j+i+1]; if(!Map[ch]) Map[ch]=1; else { f=1; break; } } } if(f) cout<<str<<" is NOT surprising."<<endl; else cout<<str<<" is surprising."<<endl; } } return 0; }
POJ训练计划3096_Surprising Strings(STL/map)
标签:art pac ++ ios color eid div tar ring
原文地址:http://www.cnblogs.com/claireyuancy/p/6753389.html