Update 1001.A+B Format.cpp

This commit is contained in:
hao14293
2018-12-08 10:32:01 +08:00
committed by GitHub
parent 6b91442a7b
commit e7c745e7b8

View File

@@ -1 +1,14 @@
#include <iostream>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
string s = to_string(a + b);
int len = s.length();
for(int i = 0; i < len; i++){
cout << s[i];
if(s[i] == '-') continue;
if((i + 1) % 3 == len % 3 && i + 1 != len) cout << ",";
}
return 0;
}