#include <bits/stdc++.h> using namespace std; typedef long long LL; int main() {     int a,b;     scanf("%d%d",&a,&b);     bool t=false;     int ans = a+b;     if(ans<0)         t=true;         ans = abs(ans);     stringstream str;     str<<ans;     string s = str.str();     int len = s.length();     reverse(s.begin(),s.end());     int counts = 0;     string _ws;     for(int i=0;i<len;i++)     {         _ws.push_back(s[i]);         counts++;         if(counts==3&&i!=len-1)         {             counts = 0;             _ws.push_back(',');         }     }     if(t) _ws.push_back('-');     reverse(_ws.begin(),_ws.end());     cout<<_ws<<endl; }
点赞 评论

相关推荐

面向对象的火龙果很爱...:去吃一顿炸鸡就走
点赞 评论 收藏
分享
点赞 评论 收藏
分享
06-07 19:59
门头沟学院 C++
补药卡我啊😭:都快15年前的了还在11新特性
你的简历改到第几版了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务