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

Re:请教一下,这个是哪里出错了?提交时提示WA、 谢谢了、

Posted by 898617222 at 2011-04-10 21:51:18
In Reply To:请教一下,这个是哪里出错了?提交时提示WA、 谢谢了、 Posted by:898617222 at 2011-04-10 21:48:30
> #include<iostream>
> #include<math.h>
> #include<string.h>
> using namespace std;
> 
> void f(int a[],int b[],int n)
> {
> 	int i;
> 	for(i=0;i<n;i++)
> 	{
> 		a[i]=b[i]+a[i];
> 		a[i+1]=a[i]/10+a[i+1];
> 		a[i]=a[i]%10;
> 	}
> 
> 
> 	
> }
> int main()
> {
> 	char m[100],s[100]="0";
> 	int x[100],y[100];
> 	int i=0,j,t,lena,lenb;
> 	memset(x,0,sizeof(x));
> 	memset(y,0,sizeof(y));
> 	while(1)
> 	{
> 	    cin>>m;
> 		if(strcmp(m,s)==0) break;
> 		if(i<1) 
> 		{
> 			lena=strlen(m);
> 			for(j=0;j<lena;j++)
> 				x[strlen(m)-1-j]=m[j]-'0';
> 
> 		}
> 		else 
> 		{
> 			lenb=strlen(m);
> 			for(j=0;j<lenb;j++)
> 				y[strlen(m)-1-j]=m[j]-'0';
> 		}
> 		if(i>=1)
> 		{
> 		    if(lena>=lenb) t=lena;
> 			else t=lenb;
> 			f(x,y,t);
> 		}
> 		i++;
> 
> 	}
> 	for(i=99;i>=0;i--)
> 		if(x[i]!=0) break;
> 	for(;i>=0;i--)
> 		cout<<x[i];
> 	
> 	return 0;
> }
 1503的题

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