#include <iostream>
#include <string>
using namespace std;
int main()
{
int a, b, c;
string s;
cin >> a >> b;
c = a + b;
s = to_string(c);
// transform the int to string
int sLength = s.length();
for (int i = sLength - 3; i >0; i=i-3)
{
if ((i == 1) && (c < 0))
{
continue;
}
s.insert(i, ",");
}
cout << s;
}
PTA 甲级练习【1001】
最新推荐文章于 2020-03-02 20:13:05 发布