#include <stack>
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
bool flag = false;
int sum = a + b;
if(sum < 0) {
sum = -sum;
flag = true;
}
stack<int>S;
if(sum == 0) {
S.push(0);
}
while(sum != 0) {
S.push(sum % 10);
sum /= 10;
}
if(flag) {
cout << "-";
}
cout << S.top();
S.pop();
int n = 0;
while(!S.empty()) {
if(S.size() % 3 == 0) {
cout << ",";
}
cout << S.top();
S.pop();
}
return 0;
}
PAT 甲级 1001
最新推荐文章于 2022-04-28 14:01:30 发布