| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 106666 | 方文轩 | 高精度加法 | C++ | Accepted | 100 | 0 MS | 260 KB | 480 | 2023-10-14 08:24:58 |
#include<bits/stdc++.h> using namespace std; int a1[5005],b1[5005],c[5005]; int main() { string a,b; cin>>a>>b; int la=a.size(); int lb=b.size(); for(int i=1;i<=la;i++) a1[i]=a[la-i]-'0'; for(int i=1;i<=lb;i++) b1[i]=b[lb-i]-'0'; int lc=1; int x=0; while(lc<=la||lc<=lb) { c[lc]=a1[lc]+b1[lc]+x; x=c[lc]/10; c[lc]%=10; lc++; } c[lc]=x; while(!c[lc]&&lc!=1) lc--; for(int i=lc;i>=1;i--) cout<<c[i]; cout<<endl; return 0; }