原题目地址:https://pintia.cn/problem-sets/994805342720868352/problems/994805526272000000
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int c = a+b;
if(c==0){
//printf("0\n");
cout<<0<<endl;
return 0;
}
if(c<0){
cout<<"-";
c=-c;
}
int k = log10(c);
int n = k/3;
int m = pow(1000,n);
int t=0;
while(t<=n){
int a = c/m;
if(t==0) cout<<a;
else
cout<<setw(3)<<setfill('0')<<a;
c = c%m;
m/=1000;
t++;
if(t<=n) cout<<",";
}
cout<<endl;
return 0;
}