Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
菜鸟遇到水题还是很爽的 n62#include <memory.h> #include <iostream> #include <map> #include <string> using namespace std; int main() { string str; while(cin>>str) { if(str=="*") break; else { int turns=str.length()-1; bool flag=false; for(int i=1;i<=turns&&flag==false;i++) { map<string ,int> mmap; for(int k=0;k+i<=str.length()-1;k++) { char temp[2]; temp[0]=str[k]; temp[1]=str[k+i]; string tempstr(temp); tempstr.resize(2); mmap[tempstr]++; if(mmap[tempstr]!=1) { flag=true; break; } } } if(flag==false) cout<<str<<" is surprising."<<endl; else cout<<str<<" is NOT surprising."<<endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator