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 huangjia at 2006-04-02 10:39:06 on Problem 2602
#include<iostream>
using namespace std;
struct large
{
	int i;
	int j;
};
int mian()
{
	int n;
	while(cin>>n)
	{
		large*m=new large[n];
		int *x=new int [n];
		for(int i=0;i<n;i++)
			cin>>m[i].i>>m[i].j;
		int l=0,j=1,sum=0;
		for(i=n-1;i>=0;i--)
		{
			x[i]=m[i].i+m[i].j+l;
			if(x[i]>9)
			{
				l=1;
				x[i]%=10;
			}
			else
			{
				l=0;
			}
			sum+=x[i]*j;
			j*=10;
			if(i==0&&l==1)
				sum=sum+l*j;
		}
		cout<<sum<<endl;
	}
	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