Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

见水贴代码!

Posted by speedcell4 at 2011-04-26 17:19:38 on Problem 2608
#include<iostream>
using namespace std;
char a[21];
int kan(char a)
{
    if(a=='B'||a=='F'||a=='P'||a=='V') return 1;
    if(a=='C'||a=='G'||a=='J'||a=='K'||a=='Q'||a=='S'||a=='X'||a=='Z') return 2;
    if(a=='D'||a=='T') return 3;
    if(a=='L') return 4;
    if(a=='M'||a=='N') return 5;
    if(a=='R') return 6;
    else return 0;
}
int main()
{
    while(gets(a))
    {
        int l=strlen(a);
        for(int i=0,now=0,last=0;l-i;i++)
        {
            now=kan(a[i]);
            if(now&&now!=last)
            {
                cout<<now;
            }
            last=now;
        }
        cout<<endl;
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator