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 ZYWei at 2008-03-05 18:48:33 on Problem 3510
In Reply To:请问各位大虾,谁能帮我看看是什么问题呀? Posted by:ZYWei at 2008-03-05 18:25:29
#include<stdio.h>
void change(char a[],char c)
{
	a[0]=a[1];
	a[1]=a[2];
	a[2]=a[3];
	a[3]=c;
}

int main()
{
	char out[100000];
	char c;
	int i=0;
	char a[4]={'EOF','EOF','EOF','EOF'};
	while((c=getchar())!='EOF')
	{
		change(a,c);
		int j=3;
		if(c>='a'&&c<='z'||c==' '||c=='\n'||c=='\t')
		{
			if(c=='i'&&i>1&&a[j-1]=='e')
			{
				if(a[j-2]=='c')
					out[i++]=c;
				else
				{
					out[i-1]='i';
					out[i++]='e';
				}
			}
			else if(c=='d'&&i>0)
			{
				if(a[j-1]=='d')
					out[i-1]='p';
				else
					out[i++]='d';
			}
			else if(c=='k'&&i>2&&a[j-1]=='n'&&a[j-2]=='i'&&a[j-3]=='p')
			{
				out[i+1]='d';
				out[i]='y';
				out[i-1]='o';
				out[i-2]='l';
				out[i-3]='f';
				i=i+2;
			}
			else
				out[i++]=c;
		}
		else
			continue;
	}
	for(int j=0;j<i;j++)
		printf("%c",out[j]);
	printf("\n");
	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