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

wrong 到死!!!!!!!!!!!

Posted by Nedvid at 2007-11-01 11:12:46 on Problem 2389
#include<stdio.h>//2007/10/31
#include<string.h>
void main()
{
	int n,m,i,j,index,result[200];
	char a[100],b[100];
	for(i=0;i<200;i++)result[i]=0;
	gets(a);gets(b);m=strlen(a);n=strlen(b);
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			result[i+j]+=(b[i]-'0')*(a[j]-'0');
			if(result[i+j]>=10)
			{
				result[i+j+1]+=(result[i+j]/10);
				result[i+j]=result[i+j]%10;
			}
		}
		index=result[m+n-1]==0?m+n-2:m+n-1;
       for(i=0;i<=index;i++)
    	printf("%d",result[i]);
     	printf("\n");
	/*for(i=199;i>=0;i--)
		if(result[i]!=0){index=i;break;}
	if(i<0)printf("000\n");
	else
	{
	for(i=0;i<=index;i++)
		printf("%d",result[i]);
	printf("\n");
	}*/
}

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