| ||||||||||
| 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 | |||||||||
为啥老超时啊,气死我了#include <iostream>
using namespace std;
//2656
char convert(char ch);
int main(void){
char a[64];
int i,len,num;
while(a[0] = cin.get())
{
a[0] = convert(a[0]);
for(i = 1;i<64;i++)
{
a[i] = cin.get();
if(a[i] == '\n')
break;
a[i] = convert(a[i]);
}
len = i;
num = 0;
for(i = 0;i<len;i++)
{
if(a[i] == a[i+1])
a[i] = '*';
if(a[i] != '*')
{
cout<<a[i];
num++;
}
}
if(num!=0)
cout<<endl;
}
return 0;
}
char convert(char ch)
{
if(ch=='B'||ch=='F'||ch=='P'||ch=='V')
ch = '1';
else if(ch=='C'||ch=='G'||ch=='J'||ch=='K'||ch=='Q'||ch=='S'||ch=='X'||ch=='Z')
ch = '2';
else if (ch == 'D'||ch == 'T')
ch = '3';
else if(ch == 'L')
ch = '4';
else if(ch == 'M'||ch == 'N')
ch = '5';
else if(ch == 'R')
ch = '6';
else
ch = '*';
return ch;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator