| ||||||||||
| 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 | |||||||||
why? compile error#include <iostream>
#include <cstring>
#include <map>
using namespace std;
const int N=100;
int main()
{
char s[N]={'\0'};
while(cin>>s&&s[0]!='*')
{
int len=strlen(s);
if(len<=2)
{
cout<<s<<" is surprising.\n";
}
else
{
bool sign;
for(int d=1;d<=len-1;d++)
{
sign = true;
map< string, bool > mark;
for(int i=0;i<len-d;i++)
{
char sub[3]={s[i],s[i+d],'\0'};
if(mark[sub]==true)
{
sign=false;
break;
}
else
{
mark[sub]=true;
}
}
if(!sign)
break;
}
if(sign)
cout<<s<<" is surprising.\n";
else
cout<<s<<" is NOT surprising.\n";
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator