http://acm.hdu.edu.cn/showproblem.php?pid=1002 输入的数都是正整数,比较好处理,注意进位. //非负大整数加法 # include <stdio.h> # include <string.h> # define MAX 1100 int main() { int t; char Num1[MAX], Num2[MAX], Num3[MAX];//Num3[] 用于保存结果 scanf("%d", &t); f
这种题的解题方法都差不多,不停的循环,不过如果做一下细分,效率应该可以提升很多,下面把最常规效率也最低的代码贴上,有时间再优化 #include <iostream> using namespace std; int main() { int x, y, z; ; x <= ; x++ ) { ; y <= ; y++) { ; z <= ; z++) { * x + * y + z) == ) { cout<<"x = "<<x
题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -&