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:加法……10行啊……

Posted by Ikki at 2005-08-01 16:58:40
In Reply To:加法……10行啊…… Posted by:Ikki at 2005-08-01 16:58:15
void add(bigint x, bigint y)
{
    long i, c, n;
    c = 0;
    n = max(x[0], y[0]);
    for (i = 1; i <= n; i++) {
	x[i] += y[i] + c;
	if (x[i] >= BASE) {
	    c = 1;
	    x[i] -= BASE;
	} else {
	    c = 0;
	}
    }
    if (c > 0) x[++n] = c;
    x[0] = 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