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

1001题:我的代码不知道出啥问题了<请指教>

Posted by 200892458 at 2008-12-18 19:27:10 on Problem 1011
#include<stdio.h>
#include<string.h>
int main()
{
	char a[10][128],z;
	int b[10][64],c[10][100],i=0,n[10],m[10],j,k,t;
	scanf("%d",&n[0]);
	if(n[0]!=0)
	{   z=getchar();
		gets(a[0]);
	}
	while(n[i]!=0)
	{
		i++;
		scanf("%d",&n[i]);
		if(n[i]!=0)
		{   z=getchar();
			gets(a[i]);
		}
	}
	for(j=0;j<i;j++)
	{ 
		t=0;
		for(k=0;a[j][k]!='\0';k++)
		{ 
			if(a[j][k]>='0'&&a[j][k]<='9')
			{
				b[j][t]=a[j][k]-48;
				t++;   
			}
		}
		b[j][t]=0;
	}
	for(j=0;j<i;j++)
    { 
		n[j]=0;
		m[j]=b[j][0];
		for(k=0;b[j][k]!=0;k++)
		{ 
			if(b[j][k]>m[j])
				m[j]=b[j][k];
			n[j]=n[j]+b[j][k];
		}
    }
	for(j=0;j<i;j++)
    { 
		t=0;
		for(k=1;k<n[j];k++)
		{ 
			if(n[j]%k==0)
			{
				c[j][t]=k;
				t++;
			}
		}
		c[j][t]=0;
    }
    for(j=0;j<i;j++)
		for(k=0;c[j][k]!=0;k++)
			if(c[j][k]>=m[j])
			{
				printf("%d\n",c[j][k]);
				break; 
			}
			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