-
个人简介
2892449003
Piaoztsdy (pztsdy/pztsdy2023)
QQ:
Wechat:
$$\texttt{\boxed{\color{#ccc}{\texttt{Because i am not a hero.}}}} $$
Welcome to my website
An interesting video
临时主页:
$\texttt{\colorbox{#ff0101}{Get Error:}\colorbox{#cccccc}{Cannot connect to PIAOZTSDY's server!}}$ $ \texttt{\colorbox{#ddd}{Click \color{#3498db}{here} \color{#333}to find the help.\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }} $
$$\small{\text{如果你认为某个同学有问题,欢迎向Piao OJ反馈,以帮助更多的同学。}} $$ $$\color{#dedede}\boxed{\color{black}\text{ 此人太菜了,严重拉低洛谷平均水平~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}} $$$$\small\color{#0e90d2}\text{取消~~~~~~~~~~~~~~~~~~~~~~~~}\color{#dedede}\text{|}\color{#0e90d2}\text{~~~~~~~~~~~~~~~~~~~~~~~~确定} $$
回到顶部
高精度加法
#include<stdio.h> #include<string> #include<string.h> #include<iostream> using namespace std; int compare(string str1,string str2) { if(str1.length()>str2.length()) return 1; else if(str1.length()<str2.length()) return -1; else return str1.compare(str2); } string add(string str1,string str2) { string str; int len1=str1.length(); int len2=str2.length(); if(len1<len2) { for(int i=1;i<=len2-len1;i++) str1="0"+str1; } else { for(int i=1;i<=len1-len2;i++) str2="0"+str2; } len1=str1.length(); int cf=0; int temp; for(int i=len1-1;i>=0;i--) { temp=str1[i]-'0'+str2[i]-'0'+cf; cf=temp/10; temp%=10; str=char(temp+'0')+str; } if(cf!=0) str=char(cf+'0')+str; return str; } int main() { string str1,str2; cin>>str1>>str2; cout<<add(str1,str2)<<endl; return 0; } -
通过的题目
-
最近活动
-
最近编写的题解
题目标签
- 其他
- 4
- 基础算法
- 3
- 数学
- 3
- 递推
- 2
- 语言基础
- 2
- 系统测试
- 1
- 入门
- 1
- 循环结构
- 1
- 排序
- 1
- 数组
- 1
- 结构体
- 1
- 模拟
- 1
- 动态规划
- 1
- 贪心
- 1
- 递归
- 1