首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
yjzhou20
2026年3月18日 11:20
大整数加法 题解:
P1474
回复 0
|
赞 3
|
浏览 57
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int main(){ string s1; string s2; while(cin>>s1>>s2){ vector<int> v1; ve...
太一
2026年3月17日 18:21
大整数加法 题解:
P1474
回复 1
|
赞 4
|
浏览 45
#include<iostream> #include<cmath> #include<algorithm> #include<string> #include<map> using namespace std; int main() { string s1, s2; while (cin >> s1 >> s2) { int arr[10000];  ...
无名吟
2026年3月17日 10:32
大整数加法 C语言题解:
P1474
回复 0
|
赞 2
|
浏览 40
char c[1005]={0}; 存储想加结果的数组c一定要初始化,否则在print函数中计算strlen()会出错,正确率50% #include<stdio.h> #include<string.h> #include<stdlib.h> void add(char a[], char b[], char c[]){ int t=0; int len=strlen(a); //c[len+1]='\0'; for(int i=len-1; i>=0; i--){ int he=(a[i]-'0...
Jinx_K
2026年3月11日 14:38
大整数加法 题解:reverse+add
P1474
回复 0
|
赞 8
|
浏览 102
#include <bits/stdc++.h> using namespace std; int main() { string a,b; while(cin>>a>>b) { reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); int put=0; int flag=0; for(int i=0;i<a.size();i++) { put+=(a[i]-'0'+b[i]-'0'); a[i]=put%10+...
uly
2026年3月5日 19:18
大整数加法 题解:
P1474
回复 0
|
赞 0
|
浏览 92
import java.math.*; import java.util.*; public class Main{ public static void main(String[] args) { Scanner s = new Scanner(System.in); while(s.hasNext()){ BigInteger a,b; a = s.nextBigInteger(); b = s.nextBigInteger(); System.out.println(a.add(b)); } } }
bro
2026年2月25日 14:04
大整数加法 题解:c++写法
P1474
回复 0
|
赞 4
|
浏览 172
#include <bits/stdc++.h> using namespace std; int main(){ string a,b; while(cin >> a >> b){ int num[1005] = {0}; if(a.size() < b.size()) swap(a,b); //让a最长 &n...
Ranz
2026年2月19日 01:17
大整数加法 题解:
P1474
回复 0
|
赞 1
|
浏览 131
#include<bits/stdc++.h> using namespace std; // 大整数加法函数 string addBigNumbers(string num1, string num2) { string result = ""; int i = num1.length() - 1; int j = num2.length() - 1; int carry = 0; // 进位 ...
kawhileo
2026年2月11日 15:28
大整数加法 题解:c++string
P1474
回复 0
|
赞 0
|
浏览 172
#include<bits/stdc++.h> using namespace std; //string是由一个个char组成 string add(string a,string b){ int la=a.size(),lb=b.size(); //处理前导0,如00001321+001215 int real=0; while(a[real]==0&&real<la){ &nb...
langlang23
2026年2月10日 11:08
大整数加法 题解: C++ string 存储,按位加,逆序输出
P1474
回复 0
|
赞 2
|
浏览 116
思路:字符串存储 a ,b ,输出字符串 result ,对 a b 从各自的最后一位进行加,得到的结果 temp = anum + bnum + carry; 将其余数加入到 result 中, carry = temp / 10; 注意点:判断条件是 a b 或者 carry 都不为零。 #include <iostream> #include <string> #include <algorithm> using namespace std; string addStr(string a...
mlx
2026年2月4日 23:04
大整数加法 题解:
P1474
回复 0
|
赞 2
|
浏览 104
#include<iostream> using namespace std; string a,b; void work() { int t=0; for(int i=a.size()-1;i>=0;i--) { int x=a[i]-'0'; int y=b[i]-'0'; int res=x+y+t; t=res/10; res=res%10; a[i]='0'+res; } if(t==1) cout<<t; cout<<a<<endl; }...
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
大整数加法 题解: