mirror of
https://github.com/hao14293/2021-Postgraduate-408.git
synced 2026-07-17 03:30:32 +08:00
Update 1001.A+B Format.cpp
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user