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

Why wa? I can not find any mistakes anyhow. (另有耐人寻味的......)

Posted by 444444 at 2006-07-21 20:48:53 on Problem 1577
国家大剧院骄傲——到30亿的国家大剧院看戏是每个国人的梦想! 
为CCTV新大楼骄傲——50亿的新大楼让多少国人看电视时心潮澎湃! 
为上海磁悬浮骄傲——中国人用600亿解决30公里的交通问题多么令世人骄傲! 
为中共纪检委骄傲——让5000多贪官带走400多亿美金到国外! 
#include<iostream>
using namespace std;
int f[99];
void pre(char d[40],int f[99]);
int main()
{
	char temp[40],d[40];
	int i=0,j,k=0;
	while(cin>>temp)
	{
		if(temp[0]=='*'||temp[0]=='$')
		{
			i=k=0;
			pre(d,f);
			cout<<endl;
			if(temp[0]=='$')
				break;
			memset(f,0,sizeof(f));
			for(j=0;j<35;j++)
				d[j]=' ';
		}
		else
		{
			int l=strlen(temp);
			for(j=0;j<l;j++)
			{
				d[k]=temp[j];
				k++;
				f[temp[j]]=i;
			}
			i++;
		}
	}
	return 0;
}
void pre(char d[40],int f[99])
{
	int i;
	int j=0;
	for(i=1;d[i]>='A'&&d[i]<='Z';i++)
		if(f[d[j]]<f[d[i]])
			j=i;
	cout<<d[j];
	char left[40];
	int k=0;
	for(i=0;d[i]>='A'&&d[i]<='Z';i++)
		if(d[i]<d[j])
		{
			left[k]=d[i];
			k++;
		}
	if(k==1)
		cout<<left[0];
	if(k>1)
		pre(left,f);
	int r=0;
	char right[40];
	for(i=0;d[i]>='A'&&d[i]<='Z';i++)
		if(d[i]>d[j])
		{
			right[r]=d[i];
			r++;
		}
	if(r==1)
		cout<<right[0];
	if(r>1)
		pre(right,f);
}

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