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

WA,请大牛们帮我看看什么问题

Posted by kakazwy22 at 2011-07-04 22:17:38 on Problem 2503
#include<iostream>
using namespace std;

char ary[1000000];
char bry[1000000];

int main(){
	char temp[20];
	int i,j;
	int count=0;
	int work;

	memset(ary,0,sizeof(ary));
	memset(bry,0,sizeof(bry));

	while(cin.getline(temp,20) && temp[0]!='\0'){

		i=0;
		while(temp[i]!=' '){
			ary[10*count+i]=temp[i];
			i++;
		}
		i++;
		
		j=0;
		while(temp[i]!='\0'){
			bry[10*count+j]=temp[i++];
			j++;
		}
		count++;
	}

	while(gets(temp)){
			j=0;
			i=0;
			while(temp[j]!='\0' && i<=count){
				work=1;
				if(temp[j++]!=bry[10*i+j]){
					work=0;
					i++;
					j=0;
					continue;
				}
			}
		if(work){
			for(j=0;ary[10*i+j]!=0;j++)
				cout<<ary[10*i+j];
			cout<<endl;
		}
		else	cout<<"eh"<<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