| ||||||||||
| 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 | |||||||||
WA了,不知道哪里不对啊,帮忙看下#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
int main()
{
vector<string> v1,v2;
char str[100];
bool wow,yeah;
while(gets(str))
{
if(str[0]=='X')
break;
v1.push_back(str);
}
while(gets(str)&&str[0]!='X')
{
v2.push_back(str);
}
for(int i=0;i<v2.size();i++)
{
wow=false;
yeah=true;
sort(v2[i].begin(),v2[i].end());
while(yeah)
{
for(int k=0;k<v1.size();k++)
if(equal(v2[i].begin(),v2[i].end(),v1[k].begin()))
{
wow=true;
cout<<v1[k]<<endl;
}
yeah=next_permutation(v2[i].begin(),v2[i].end());
}
if(wow)
printf("******\n");
else
printf("NOT A VALID WORD\n******\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