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

Re:郁闷 死了,我 的怎么老说我结果对而输出格式不对阿 高手们给我看看我这段程序问题出在哪,我都快崩溃了!!!!!!!!!!

Posted by Iamjw at 2006-07-04 15:05:16 on Problem 2608
In Reply To:Re:郁闷 死了,我 的怎么老说我结果对而输出格式不对阿 高手们给我看看我这段程序问题出在哪,我都快崩溃了!!!!!!!!!! Posted by:lg8t4bysq8 at 2005-11-15 09:34:29
> #include<iostream>
> using namespace std;
> int main()
> {
> 	char a[21],t[21];
> 	int b[21],i,j,c;
> 	while(scanf("%s",&a)!=EOF)
> 	{
> 		int l=strlen(a);
> 		for(i=0;i<l;i++)
> 		{
> 			if(a[i]=='B' || a[i]=='F' || a[i]=='P' || a[i]=='V')
> 			{
> 				b[i]=1;
> 			}
> 			else if (a[i]=='C' || a[i]=='G' || a[i]=='J' || a[i]=='K' || a[i]=='Q' || a[i]=='S' || a[i]=='X' || a[i]=='Z')
> 			{
> 				b[i]=2;
> 			}
> 			else if(a[i]=='D' || a[i]=='T')
> 			{
> 				b[i]=3;
> 			}
> 			else if(a[i]=='L')
> 			{
> 				b[i]=4;
> 			}
> 			else if(a[i]=='M' || a[i]=='N')
> 			{
> 				b[i]=5;
> 			}
> 			else if(a[i]=='R')
> 			{
> 				b[i]=6;
> 			}
> 			else
> 			{
> 				b[i]=0;
> 			}
> 		}
> 		c=0;
>     	for(j=0;j<l;j++)
> 		{
>             if(b[j]==0)
> 				continue;
> 			else
> 			{
> 				if(j-1>=0)
> 				{
>                 	if(b[j]==b[j-1])
> 			        	continue;
> 				}
> 					t[c]=b[j]+48;
> 					c++;
> 			}
> 		}
> 		if(c==0)
> 			continue;
> 		for(int z=0;z<c;z++)
> 		   cout<<t[z];
> 		cout<<endl;
> 	}
> 	return 0;
> }

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