首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
Cookie‘s AE86
2024年3月18日 16:58
大整数加法 题解:c++和python实现(python不存在取值范围
P1474
回复 0
|
赞 4
|
浏览 1.3k
c++实现 #include<bits/stdc++.h> using namespace std; int main(){ string s1, s2; int lens1, lens2, lens; int tmp; bool jinwei = false; //进位 while(cin >> s1){ string s; cin >> s2; reverse(s1.begin(), s1.end());...
aolutuolaman
2024年3月14日 22:53
大整数加法 题解:c++
P1474
回复 0
|
赞 8
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; int main() { string s1, s2; while (cin >> s1 >> s2) { int jw = 0; // 进位,初始化为0 for (int i = s1.size() - 1; i != -1; i--) { // 从字符串末尾开始逐位相加 if ((s1[i] - '0') + (s2[i] - '0') + jw >= 10) ...
光明守护神
2024年3月14日 20:04
大整数加法 题解:C++
P1474
回复 0
|
赞 1
|
浏览 1.2k
#include<iostream> #include <string> using namespace std; int main() { string a, b; while (cin >> a >> b) { int jw = 0;//进位 auto i = a.end() - 1, j = b.end() - 1; for (; i != a.begin(); i--, j--) { if (*i + *j + jw > 9 + 2 * '0') { ...
799
2024年3月9日 10:23
大整数加法 题解:
P1474
回复 0
|
赞 1
|
浏览 1.4k
#include<bits/stdc++.h> using namespace std; string Add(string a, string b) { //让a的长度大于b if(a.size() <b.size()) swap(a,b); //模拟加法运算,用到进位carry string r(a.size(),0);//存放a+b的和 b.insert(b.begin(),a.size() - b...
AA蚊
2024年2月23日 23:12
大整数加法 题解:
P1474
回复 0
|
赞 2
|
浏览 1.3k
#include<iostream> #include<string> #include<sstream> using namespace std; void main(){ string s1,s2;//字符串存数 while (cin>>s1>>s2) { int len = s1.length(); //转入数组...
冷喵
2024年2月10日 19:02
大整数加法 题解:c++版本
P1474
回复 0
|
赞 3
|
浏览 1.8k
#include <stdio.h> #include <iostream> #include <string> #include <algorithm> using namespace std; string add(string a, string b) { if (a.length() < b.length()) a.swap(b);//a为较长的字符串 string ans(a.length(), 0);//初始化长度为较长字符串的长度 b.insert(0, a.length() - b....
小王桐学
2024年2月8日 20:33
大整数加法 题解:C题解easy
P1474
回复 0
|
赞 0
|
浏览 1.1k
#include <stdio.h> #include <string.h> int flag; void Sum(char *s1,char *s2) { int n = strlen(s1)-1; while(n >= 0) { if(n == 0) { if((s1[n] - '0') + (s2[n] - '0') >= 10) flag = 1; } else if((s1[n] - '0') + (s2[n] - '0') >= 10) s1[n-1]+...
孙某人
2024年1月28日 13:26
大整数加法 题解:求大佬帮忙看看,一直显示栈溢出错误 50%
P1474
回复 4
|
赞 2
|
浏览 1.2k
#include <iostream> #include <string.h> using namespace std; int main(){ char a[100][1200]; char b[100][1200]; char cc[100][1200]; int len; for(int j=0;j<100;j++){ for(int i=0;i<1200;i++){ a[j][i]=0; b[j][i]=0; cc[j][i]=0; } } int c=0; while(1){...
Lucky_Bug
2020年8月3日 16:57
见到大数相加或相乘,建议用java
P1474
回复 1
|
赞 5
|
浏览 11.8k
import java.math.BigInteger; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); //相当于在c中没有printf需要先new出来一个标准输入 while (sc.hasNext()) { BigInteger a = sc.nextBigInteger(); ...
tlsn
2024年1月11日 09:33
大整数加法 题解:AC
P1474
回复 0
|
赞 0
|
浏览 955
#include <iostream> #include <cstring> using namespace std; const int N=100010; int A[N],B[N],C[N]; int Add(int a[],int b[],int c[],int len){ int carry = 0; for(int i=0;i<=len;i++){ int ...
1
2
3
4
题目
大整数加法
题解数量
39
发布题解
在线答疑
热门题解
1
大整数加法 题解:暴力水题
2
大整数加法 题解:reverse+add
3
大整数加法 题解:c++
4
大整数加法(大数问题py直接秒了) 题解:
5
大整数加法 题解(C++解法,模板题):
6
见到大数相加或相乘,建议用java
7
大整数加法 题解:C语言,用字符数组存储大数
8
大整数加法 题解:c++
9
大整数加法 题解:c++和python实现(python不存在取值范围问题,多大都能算,就是这么强大)
10
大整数加法 题解: