| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:加法……10行啊……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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator