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 |
我在我的电脑上运行时正确的,为什么在online上得到的是“wrong answer”?如下是我的源程序: #include <iostream> #include <string> using namespace std; int main() { string str; cin>>str; int i, j, k,tag = 0; string::size_type dist; while(str!="*") { for( dist = 0; dist <= str.size(); dist++) { k = str.size() - dist - 1; string substr[1000]; for( i = 0; i < k; i++) { substr[i] = substr[i] + str[i]; substr[i] = substr[i] + str[i + dist + 1]; } for(i = 0; i < k-1; i++) for(j = i + 1 ; j < k; j++) if(substr[i] == substr[j] ) { tag = 1; cout<<str<<" is NOT surprising."<<endl; break; } if(tag == 1) break; } if(dist > str.size()) cout<<str<<" is surprising."<<endl; cin>>str; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator