- #include
- #include
- #include
- #include
- using namespace std;
- int main()
- {
- string a1,b1;
- //char a1[300],b1[300];
- int a[300],b[300],c[300],lena,lenb,lenc,i,x;
-
- memset(a,0,sizeof(a));
- memset(b,0,sizeof(b));
- memset(c,0,sizeof(c));
-
- //输入加数与被加数
- getline(cin,a1);
- getline(cin,b1);
- cin>>b1;
- //gets(a1);
- //gets(b1);
-
- lena=a1.size();
- lenb=b1.size();
-
- //将输入字符串倒置
- for (i=0;i<=lena-1;i++)
- {
- a[lena-i]=a1[i]-48; //加数放入a数组
- }
-
- for (i=0;i<=lenb-1;i++)
- {
- b[lenb-i]=b1[i]-48; //加数放入b数组
- }
-
- lenc =1;
- x=0;
- while ( lenc <=lena || lenc <=lenb )
- {
- //两数相加
- c[lenc]=a[lenc]+b[lenc]+x;
- x=c[lenc]/10;
- c[lenc]%=10;
- lenc++;
- }
- c[lenc]=x;
-
- //去掉多余的0
- while(c[lenc]==0 && lenc>1)
- {
- lenc--;
- }
- /*
- //处理最高进位
- if (c[lenc]==0)
- lenc--;
- */
-
- //输出结果
- for (i=lenc;i>=1;i--)
- cout<
-
- cout<
-
- return 0;
- }
C++代码(2)
- /*
- 1.6编程基础之一维数组 10大整数加法(AC)-2022.08.13
- http://noi.openjudge.cn/ch0106/10
- 1168:大整数加法
- http://ybt.ssoier.cn:8088/problem_show.php?pid=1168
- P1601 A+B Problem(高精)
- https://www.luogu.com.cn/problem/P1601
- */
- #include
- using namespace std;
- char a[100045],b[100098],c[100056];
- int aa[100087],bb[100078],cc[100089];
- int main()
- {
- scanf("%s",&a);
- scanf("%s",&b);
- int lena=strlen(a);
- int lenb=strlen(b);
-
- for(int i=0;i
- {
- aa[i]=a[lena-i-1]-'0';
- }
-
- for(int i=0;i
- {
- bb[i]=b[lenb-i-1]-'0';
- }
-
- int s=0;
- int i=0;
-
- while(i
- {
- cc[i]=aa[i]+bb[i]+s;
- s=cc[i]/10;
- cc[i]=cc[i]%10;
- i++;
- }
-
- cc[i]=s;
-
- while(1)
- {
- if( cc[i]==0 && i>=1)
- i--;
- else break;
- }
-
- for(i;i>=0;i--)
- cout<
-
- return 0;
- }
C++代码(3)
- #include
- using namespace std;
- int lena,lenb,lenc;
- const int maxL=200+10;
- int a[maxL],b[maxL],c[maxL];
- void add(int a[],int lena,int b[],int lenb,int c[],int &lenc)
- {
- memset(c,0,sizeof(c));
- lenc=max(lena,lenb);
- for(int i=0;i
- {
- c[i]+=a[i]+b[i];
- if(c[i]>=10)
- {
- ++c[i+1];
- c[i]-=10;
- }
- }
- if( c[lenc] )
- {
- ++lenc;
- }
- while(c[lenc-1]==0 && lenc>1)
- {
- lenc--;
- }
- }
- int main( void )
- {
- string s;
- cin>>s;
- lena=s.length();
- for(int i=0;i
- a[i]=s[lena-1-i]-'0';
-
- cin>>s;
- lenb=s.length();
- for(int i=0;i
- b[i]=s[lenb-1-i]-'0';
-
- add(a,lena,b,lenb,c,lenc);
-
- for(int i=lenc-1;i>=0;--i)
- cout<
- cout<
-
- return 0;
- }
C++代码(4)
- #include
- using namespace std;
- int a[201],b[201],c[201];//两个用来输入,一个用来输出
- //输入
- void read(int a[])
- {
- string s;
- cin>>s;
- a[0]=s.size();
-
- //反着输入
- {
- a[a[0]-i]=s[i]-'0';
- }
- }
-
- //输出
- void write(int a[])
- {
- //正着输出
- while ((a[a[0]]==0)&&(a[0]>1)) a[0]--;
- for(int i=a[0];i>=1;i--)
- {
- }
- cout<
- }
-
- //计算
- void add(int a[],int b[])
- {
- memset(c,0,sizeof(c));
- int len=a[0]>b[0]?a[0]:b[0];
- int g=0;
- for(int i=1;i<=len;i++)
- {
- c[i]=a[i]+b[i]+g;//注意要进位
- g=c[i]/10;
- c[i]%=10;
- }
- if(g!=0)c[++len]=g;
- c[0]=len;
- }
-
- //主程序十分简洁明了
- int main()
- {
- //读入两次,一次只能读入一个
- read(a);
- read(b);
-
- add(a,b);
-
- write(c);
-
- return 0;
- }
C++代码(5)
- /*
- 1.6编程基础之一维数组 10大整数加法(AC)-2022.08.11 运算符重载
- http://noi.openjudge.cn/ch0106/10/
- */
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- using namespace std;
- const int maxn=201;
- struct bignumber
- {
- int len,s[maxn];
- bignumber(){memset(s,0,sizeof(s));len=1;}
- bignumber operator = (const char* num)
- {
- len=strlen(num);
- for(int i=0;i
-1]-'0'; - return *this;
- }
- bignumber operator = (const int num)
- {
- char a[maxn];
- sprintf(a,"%d",num);
- *this=a;
- return *this;
- }
- bignumber (const int num){*this=num;}
- bignumber (const char* num){*this=num;}
- bignumber operator+(const bignumber& a)
- {
- bignumber c;
- c.len=max(len,a.len)+1;
- for(int i=0,x=0;i
- {
- c.s[i]=s[i]+a.s[i]+x;
- x=c.s[i]/10;
- c.s[i]=c.s[i]%10;
- }
- while(c.s[c.len-1]==0&&c.len>1)c.len--;
- return c;
- }
- bool operator < (const bignumber& x)const
- {
- if(len!=x.len)return len
- for(int i=len-1;i>=0;i--)if(s[i]!=x.s[i])return s[i]
- return false;
- }
- };
- ostream& operator<<(ostream& out,const bignumber &x)
- {
- for(int i=x.len-1;i>=0;i--)cout<
- return out;
- }
- istream& operator>>(istream& in,bignumber &x)
- {
- char num[maxn];
- in>>num;
- x=num;
- return in;
- }
- bignumber a,b;
- int main()
- {
- ios::sync_with_stdio(false);
- cin>>a>>b;
- return 0;
- }
python3代码
- a = int(input())
- b = int(input())
- print(a + b)
GoC编程(C++画图)视频和资料集
GoC编程(C++画图) 视频和资料集 -- 2022.07.26_dllglvzhenfeng的博客-CSDN博客_goc下载
Scratch -> C++画图->信奥(C++)学习导航
Scratch -> C++画图->信奥(C++)学习导航_dllglvzhenfeng的博客-CSDN博客
动画学信奥 漫画学算法 CSP-J入门级 (一)、计算机基础与编程环境(依据「NOI大纲」)
动画学信奥 漫画学算法 CSP-J入门级 (一)、计算机基础与编程环境(依据「NOI大纲」)_dllglvzhenfeng的博客-CSDN博客_cspj考试大纲
动画学信奥 漫画学算法 CSP-J入门级 (二)、C++程序设计 数据结构(依据「NOI大纲」)
动画学信奥 漫画学算法 CSP-J入门级 (二)、C++程序设计 数据结构(依据「NOI大纲」)_dllglvzhenfeng的博客-CSDN博客_csp-j 数据结构
动画学信奥 漫画学算法 CSP-J入门级 (三)、算法(依据「NOI大纲」)
动画学信奥 漫画学算法 CSP-J入门级 (三)、算法(依据「NOI大纲」)_dllglvzhenfeng的博客-CSDN博客
2019 CSP-J1 CSP-S1 第1轮 初赛 答案解析及总结、视频等
2019 CSP-J1 CSP-S1 第1轮 初赛 答案解析及总结、视频等_dllglvzhenfeng的博客-CSDN博客
2020 CSP-J1 CSP-S1 第1轮 初赛 答案解析及总结、视频等
2020 CSP-J1 CSP-S1 第1轮 初赛 答案解析及总结、视频等_dllglvzhenfeng的博客-CSDN博客
2021 CSP-J1 CSP-S1 第一轮 初赛 相关题解及视频等
2021 CSP-J1 CSP-S1 第一轮 初赛 相关题解及视频等_dllglvzhenfeng的博客-CSDN博客
2019-2021 CSP-J1 CSP-S1 第一轮 初赛 相关题解及视频等
2019-2021 CSP-J1 CSP-S1 第一轮 初赛 相关题解及视频等_dllglvzhenfeng的博客-CSDN博客
2019-2021 CSP-J CSP-S 第一轮成绩及分数线汇总
2019-2021 CSP-J CSP-S 第一轮成绩及分数线汇总_dllglvzhenfeng的博客-CSDN博客_csp历年分数线
CSP-J CSP-S 初赛相关的书籍
CSP-J CSP-S 初赛相关的书籍_dllglvzhenfeng的博客-CSDN博客
2022年 CSP-J1 CSP-S1 初赛 如何进行复习 如何做题
2022年 CSP-J1 CSP-S1 初赛 如何进行复习 如何做题_dllglvzhenfeng的博客-CSDN博客
2021 CSP-J1 CSP-S1 第1轮 初赛 最后一周的计划(2021.09.15)
2021 CSP-J1 CSP-S1 第1轮 初赛 最后一周的计划(2021.09.15)_dllglvzhenfeng的博客-CSDN博客
2021CSP-J1初赛答案与讲评
2021CSP-J1初赛答案与讲评_以太以北的博客-CSDN博客_csp j1是什么
2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点
2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点_dllglvzhenfeng的博客-CSDN博客
NOIP普及组2006-2018初赛 2019 CSP-J1 2020 CSP-J1 完善程序题
NOIP普及组2006-2018初赛 2019 CSP-J1 2020 CSP-J1 完善程序题_dllglvzhenfeng的博客-CSDN博客
NOIP2006-2018 提高组 初赛试题完善程序题 CSP-S 2019 2020 初赛试题完善程序题
NOIP2006-2018 提高组 初赛试题完善程序题 CSP-S 2019 2020 初赛试题完善程序题_dllglvzhenfeng的博客-CSDN博客
2022 CSP-J1 CSP-S1 初赛 资料集(2022.07.08)
2022 CSP-J1 CSP-S1 初赛 资料集(2022.07.08)_dllglvzhenfeng的博客-CSDN博客_csp-j初赛模拟题
-
相关阅读:
Python - inspect 模块的简单使用
YoloV5+TensorRT封装|C#调用dll实现V5+TRT目标检测
猿创征文|【深度学习前沿应用】文本生成
51单片机自学报告--实验部分
2022年最新黑龙江建筑安全员真题题库及答案
【微服务~Sentinel】Sentinel之dashboard控制面板
C++程序设计期末考试复习试题及解析 3(自用~)
【普通人解题】leetcode 62. 不同路径
[超详细]SpringBoot整合WebSocket
钡铼BL124EC实现EtherCAT转Ethernet/IP的优势
-
原文地址:https://blog.csdn.net/dllglvzhenfeng/article/details/126325733