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 fatguan at 2006-07-01 21:18:41 on Problem 2608
#include<iostream.h>

void print(int *A,int num) {
	for(int i=0;i<num;i++)
		if(A[i]!=0) {
			if(i==0)
				cout<<A[i];
			else if(A[i]!=A[i-1])
				cout<<A[i];
		}
}


	

int main() {
	char A[4]={'B','F','P','V'},B[8]={'C', 'G', 'J', 'K', 'Q', 'S', 'X', 'Z'},C[2]={'D','T'},D[1]={'L'},E[2]={'M','N'},F[1]={'R'};
	int m;
	char *temp1=new char[20];
	int *temp=new int[20];
    while(true) {
		for(int i=0;i<20;i++) {
			temp1[i]='\0';	
			temp[i]=0;
		}
		cin>>temp1;
		for(int j=0;j<20;j++) {
			if(temp1[j]!='\0') {
				for(m=0;m<4;m++){
					if(A[m]==temp1[j])
						
						temp[j]=1;
				}
				for(m=0;m<8;m++) {
					if(B[m]==temp1[j])
						
						temp[j]=2;
				}
				for(m=0;m<2;m++) {
					if(C[m]==temp1[j])
						
						temp[j]=3;
				}
				for(m=0;m<1;m++) {
					if(D[m]==temp1[j])
						
						temp[j]=4;
				}
				for(m=0;m<2;m++) {
					if(E[m]==temp1[j])
						
						temp[j]=5;
				}
				for(m=0;m<1;m++) {
					if(F[m]==temp1[j])
						
						temp[j]=6;
				}
			}
			

			
			}
     	print(temp,20); 
		
	//	for(i=0;i<20;i++)
	//		cout<<temp[i];
		
	     
		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