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 ljl08 at 2007-07-23 22:30:26 on Problem 1056
#include <iostream.h>
#include <string.h>
#include <stdio.h>
int Input(char *string){
	cin.getline(string,10);
	if(*string=='9')return 0;
	return 1;
}
int min(int x,int y){
	return x<y?x:y;
}
char string[10][11];
void main(){
	int i=0,j,test=1;
	int lenth1,lenth2,k,n;
	int mi;
	int flag1,flag2;
	while(1){
		for(;i<10;i++)strcpy(string[i],"");
		i=0;
		while(Input(string[i])){i++;}
		for(j=0;j<i;j++){
			flag2=0;
			for(k=0;k<i;k++){
				if(j!=k){
					lenth1=strlen(string[j]);
					lenth2=strlen(string[k]);
					mi=min(lenth1,lenth2);
					flag1=0;
					for(n=0;n<mi;n++){
						if(string[j][n]==string[k][n])continue;
						else {
							flag1=1;
							break;
						}
					}
					if(flag1==0){flag2=1;break;}
				}
			}
			if (flag2==1)break;
		}
		if(flag2==1)printf("Set %d is not immediately decodable\n",test);
		else printf("Set %d is immediately decodable\n",test);
		test++;
	}
}

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