| ||||||||||
| 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>
using namespace::std;
struct WORD
{
string word;
int length;
};
int main()
{
int JUD=1;
int N=0;
int M=0;
WORD sa[20];
WORD diction[10000];
WORD same[20];
for(int i=0;i<10000;++i)
{
cin>>diction[i].word;
diction[i].length=diction[i].word.size();
N++;
if(diction[i].word=="#")
{
N--;
break;
}
}
WORD check[50];
for(int ii=0;ii<50;++ii)
{
cin>>check[ii].word;
check[ii].length=check[ii].word.size();
M++;
if(check[ii].word=="#")
{
M--;
break;
}
}
for(int m=0;m<M;++m)
{
int LENG=1;
int NOSAME=1;
int PIG=1;
JUD=1;
int number4=0;
for(int mn=0;mn<N;++mn)
{
if(check[m].length-diction[mn].length!=1&&check[m].length-diction[mn].length!=-1&&check[m].length-diction[mn].length!=0)
{
number4++;
break;
}
}
if(number4==N)
{
LENG=0;
cout<<check<<":";
}
if(LENG==1)
{
for(int mmmm=0;mmmm<N;++mmmm)
{
if(check[m].word==diction[mmmm].word)
{
cout<<diction[mmmm].word<<" is correct";
NOSAME=0;
}
}
if(NOSAME==1)
{
for(int mmm=0;mmm<N;++mmm)
{
int number2=0;
int iop=0;
int number=0;
int number3=0;
if(diction[mmm].length==check[m].length)
{
if(check[m].length==1)
{
same[iop].word=diction[mmm].word;
iop++;
}
else
{
for(int ppp=0;ppp<diction[mmm].length;++ppp)
{
if(diction[mmm].word[ppp]==check[m].word[ppp])
{
++number2;
}
}
if(number2==diction[mmm].length-1)
{
same[iop].word=diction[mmm].word;
iop++;
}
}
}
else if(diction[mmm].length-check[m].length==1)
{
int ipp=0;
for(int ip=0;ip<diction[mmm].length;)
{
if(diction[mmm].word[ip]==check[m].word[ipp])
{
ip++;
ipp++;
number3++;
}
else
{
ip++;
ipp=ipp;
}
}
if(number3==check[m].length)
{
same[iop].word=diction[mmm].word;
iop++;
}
}
else if(check[m].length-diction[mmm].length==1)
{
for(int io=0,ioo=0;io<check[m].length&&ioo<check[m].length;)
{
if(diction[mmm].word[io]==check[m].word[ioo])
{
io++;
ioo++;
number++;
}
else
ioo++;
}
if(number==diction[mmm].length)
{
same[iop].word=diction[mmm].word;
iop++;
}
}
if(JUD==1)
{
cout<<check[m].word<<": ";
JUD=0;
}
if(PIG==1)
{
for(int poi=0;poi<iop;++poi)
{
cout<<same[poi].word<<" ";
}
}
for(int y=0;y<iop;++y)
{
same[y].word="";
}
}
}
}
cout<<endl;
JUD=0;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator