链接:
http://acm.hdu.edu.cn/showproblem.php?pid=4099
要用c++交哦, G++ MLE
不是很懂,先粘上慢慢学习
代码:
#include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> using namespace std; #define N 100 struct node { int ID; node *next[10]; }*Head; char c[100], str[3][100]; void Add(char a[], char b[], char back[]) ///计算a+b, 结果存入c { int i, j, k; int x, y, z; int up; i = strlen(a)-1; j = strlen(b)-1; k = 0; up = 0; while(i>=0 || j>=0) { if(i<0) x = 0; else x = a[i]-'0'; if(j<0) y = 0; else y = b[j]-'0'; z = x+y+up; c[k++] = z%10+'0'; up = z/10; i--; j--; } if(up>0) c[k++] = up+'0'; for(i=0; i<k; i++) back[i] = c[k-1-i]; back[k] = '