提交时间:2024-01-16 20:47:12

运行 ID: 36795

#include <bits/stdc++.h> using namespace std; string str; int a[210]; int main(){ int len,max=0; for(int i=0;i<2;i++){ cin>>str; len=str.size(); if(len>max)max=len; for(int j=0;j<=len;j++){ a[len-j-1]+=str[j]-'0'; } for(int j=max;j>=0;j--){ if(a[max-j-1]>=10){ a[max-j-1]-=10; a[max-j]+=1; } } } int M=max+1; while(M>=0&&a[M]==0)M--; for(int i=M;i>=0;i--){ cout<<a[i]; } } //