| ||||||||||
| 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 | |||||||||
Re:哥哥姐姐们 告诉我哪错了啊 HELP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In Reply To:哥哥姐姐们 告诉我哪错了啊 HELP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Posted by:chenchen123 at 2006-03-30 19:34:59 #include <iostream.h>
#define M 20
int a[M];
char ch[M];
void main()
{
int i;
while(1)
{
for(i=0;;i++)
{
if(ch[0]=='\n')
break;
ch[i]=cin.get();
if(ch[i]=='\n')
break;
}
i=0;
int k=1;
a[0]=0;
while(ch[i]!='\n')
{
if(ch[i]=='B'||ch[i]=='F'||ch[i]=='P'||ch[i]=='V')
{
a[k]=1;
k++;
if(a[k-1]==a[k-2])
k--;
}
else if(ch[i]=='C'||ch[i]=='G'||ch[i]=='J'||ch[i]=='K'||ch[i]=='Q'||ch[i]=='S'||ch[i]=='X'||ch[i]=='Z')
{
a[k]=2;
k++;
if(a[k-1]==a[k-2])
k--;
}
else if(ch[i]=='D'||ch[i]=='T')
{
a[k]=3;
k++;
if(a[k-1]==a[k-2])
k--;
}
else if(ch[i]=='L')
{
a[k]=4;
k++;
if(a[k-1]==a[k-2])
k--;
}
else if(ch[i]=='M'||ch[i]=='N')
{
a[k]=5;
k++;
if(a[k-1]==a[k-2])
k--;
}
else if(ch[i]=='R')
{
a[k]=6;
k++;
}
else if(ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U'||ch[i]=='H'||ch[i]=='W'||ch[i]=='Y')
{
a[k]=0;
k++;
if(a[k-1]==a[k-2])
k--;
} i++;
}
for(i=1;i<k;i++)
if(a[i]!=0)
cout<<a[i];
cout<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator