Martian Addition Time Limit: 2 Seconds Memory Limit: 65536 KB In the 22nd Century, scientists have discovered intelligent residents live on the Mars. ...
分类:
其他好文 时间:
2017-04-19 09:56:20
阅读次数:
209
总结最近的题目包括高精度问题、进制转换问题、大数相乘问题、二分求幂问题、大整数排序问题、并查集操作问题 ...
分类:
其他好文 时间:
2017-04-18 19:04:27
阅读次数:
246
c++tring sum(string s1,string s2) { if(s1.length()=0;i--,j--) { s1[i]=char(s1[i]+(j>=0?s2[j]-'0':0)); if(s1[i]-'0'>=10) { s1[i]=char((s1[i]-'0')%10+'0... ...
分类:
编程语言 时间:
2017-04-15 20:38:54
阅读次数:
175
问题描述: 给定两个链表,计算出链表对应位置相加的和,如果和大于10要往后进位。用链表返回结果。其实上是一种大数加法。可以把一个大数倒着写存入链表,然后两个链表相加就是所需要的大数相加的和 输入 2 -> 3 -> 5 3-> 4 -> 6 输出 5->7->1->1 Python实现的代码 Cla ...
分类:
其他好文 时间:
2017-03-31 10:13:53
阅读次数:
160
ACM精度简单题 大数相加 描述 求两个不超过200位的非负整数的和。 输入有两行,每行是一个不超过200位的非负整数,可能有多余的前导0。输出一行,即相加后的结果。结果里不能有多余的前导0,即如果结果是342,那么就不能输出为0342。 样例输入 样例输出 大数乘法 算法思想:每个位相乘的结果放在 ...
分类:
其他好文 时间:
2017-02-21 22:10:08
阅读次数:
191
#include<stdio.h>#include<string.h>int main(){ char s1[100],s2[100]; int num1[31],num2[31],len1,len2,i,j; memset(num1,0,sizeof(num1)); memset(num2,0,s ...
分类:
编程语言 时间:
2016-12-11 13:01:31
阅读次数:
181
用getchar可以一个数字一个地读入,对于一个十进制数,最多就是10个数字,使用计数可以很方便地进行排序,再用dfs每十位十位地进行大数相加写dfs的时候需要注意,把保存状态的临时数组定义在dfs里面 #include <iostream> #include <algorithm> #includ ...
分类:
数据库 时间:
2016-11-29 22:20:46
阅读次数:
259
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. Note: 我的第一个想法就是选好两个字符串,然后模拟加法进位,然后用一个字符串接着,同时记住进位 ...
分类:
其他好文 时间:
2016-10-26 07:11:18
阅读次数:
198