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

没看懂你的程序...本人刚学C...直接贴我的好了

Posted by Spacesheep at 2005-08-20 22:52:02 on Problem 1250
In Reply To:高人指点啊!!!郁闷中……………… Posted by:up at 2005-08-20 22:34:08
#include<stdio.h>
#include<string.h>
int i,j,n,m;

bool p[1000],check[1000];
char s[500];


void main(){
	while(scanf("%d",&n),n){
		memset(p,0,sizeof(p));
		memset(check,0,sizeof(check));
		scanf(" %s ",s);
		m=0;
		for (i=0;i<strlen(s);i++){
			if (p[s[i]]){p[s[i]]=0;if (!check[s[i]])n++;else m++;}
			else 
			{p[s[i]]=1;if (n) n--;else check[s[i]]=1;};
		};
		if (m) printf("%d customer(s) walked away.\n",m);
		else printf("All customers tanned successfully.\n");
	};
	return;
};


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