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 GF at 2007-06-26 09:26:32 on Problem 2608
#include<iostream.h>                        
void main ()
{
	char c[19];
	int i=0,j,a[19];
	while(c[i]=cin.get())
	{
		switch(c[i])
		{
		case 'B':
		case 'F':
		case 'P': 
		case 'V': a[i]=1;{break;}
		case 'C':
		case 'G':
		case 'J':
		case 'K':
		case 'Q':
		case 'S':
		case 'X':
		case 'Z': a[i]=2;{break;}
		case 'D':
		case 'T': a[i]=3;{break;}
		case 'L': a[i]=4;{break;}
		case 'M':
		case 'N': a[i]=5;{break;}
		case 'R': a[i]=6;{break;}
		default: a[i]=7;
		}
		if(c[i]=='\n')
		{break;}
		++i;
	}
	if(a[0]!=7)
	{cout<<a[0];}
	else
	{
	
		for(j=1;j<=i;++j)
		{  
	     if(a[j]!=a[j-1]&&a[j]!=7)	
		 {cout<<a[j];}
		}
	}
	cout<<endl;
	cin>>i;
}




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