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:谁帮忙一下,老是WA

Posted by lingd at 2008-06-03 07:50:28 on Problem 1318
In Reply To:谁帮忙一下,老是WA Posted by:xinjin99 at 2007-08-21 12:09:14
坐标值大小在0~10^12之间,long不够大,double才够
> #include<iostream.h>
> #include<string.h>
> int main()
> {	char dic[101][40],che[40],out[101][40],temp[101][40];
> 	int n,i,j,x,k,f,f1,y,f2;
> 	for(i=0;cin>>dic[i]&&strcmp(dic[i],"XXXXXX");){
> 		for(j=0;j<i;j++)
> 			if(!strcmp(dic[i],dic[j])) break;
> 		if(j==i) i++;
> 	}
> 	while(cin>>che&&strcmp(che,"XXXXXX")){
> 		for(j=0;j<i;j++) strcpy(temp[j],dic[j]);
> 		int t[101]={0};
> 		f1=0;
> 		for(j=0;j<strlen(che);j++)
> 			for(k=0;k<i;k++){
> 				if(strlen(che)==strlen(dic[k]))
> 					for(x=0,f2=1;x<strlen(dic[k])&&f2;x++){
> 						if(che[j]==temp[k][x]){
> 							t[k]++;
> 							temp[k][x]='1';
> 							f2=0;
> 						}
> 							if(t[k]==strlen(dic[k])){
> 								strcpy(out[f1++],dic[k]);
> 								break;
> 							}
> 					}
> 			}
> 			if(f1==1)
> 				cout<<out[0]<<endl<<"******"<<endl;
> 			else if(f1>1){
> 				for(x=0;x<f1;x++)
> 					for(y=0;y<f1-x;y++)
> 						if(strcmp(out[y],out[y+1])>0){
> 							strcpy(che,out[y]);
> 							strcpy(out[y],out[y+1]);
> 							strcpy(out[y+1],che);
> 						}
> 				for(x=0;x<f1;x++)
> 					cout<<out[x]<<endl;
> 				cout<<"******"<<endl;
> 			}
> 			else cout<<"NOT A VALID WORD"<<endl<<"******"<<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