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

我用字符串长度算的,没有判断(附程序)

Posted by windbells at 2004-08-08 22:40:50 on Problem 1493
In Reply To:Re:这么简单的题都WA,实在是郁闷,给一组bt的数据吧 Posted by:hz02ruc at 2004-08-08 21:50:58
#include<stdio.h>
#include<string.h>
int main()
{
	char arry[26];
	int n,i,clj[15],min,sum;
	while(scanf("%d",&n)!=EOF&&n!=0)
	{
		for(i=0;i<n;i++)
			clj[i]=0;
		min=100;
		for(i=0;i<n;i++)
		{
			scanf("%s",arry);
			clj[i]+=strlen(arry);
			if(clj[i]!=25)
			{
				scanf("%s",arry);
				clj[i]+=strlen(arry);
			}
			clj[i]=25-clj[i];
			if(clj[i]<min)
				min=clj[i];
		}
		sum=0;
		for(i=0;i<n;i++)
			sum+=clj[i]-min;
		printf("%d\n",sum);
	}
	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