1001 A+B Format (20分)

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<sstream>
#define mm(a,x) memset(a,x,sizeof(a))
#define maxn 100005
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;

int main()
{
   
   std::ios::sync_with_stdio(false);
   std::cin.tie(0);
	int a,b;
	cin>>a>>b;
	string s=to_string(a+b);
	for(int i=0;i<s.length();i++)
	{
   
		cout<<s[i];
		if(s[i]=='-') continue;
		if((i+1)%3==s.length()%3&&i!=s.length()-1)
		cout<<",";
	}
}

全部评论

相关推荐

点赞 评论 收藏
分享
03-04 07:14
门头沟学院 C++
黑皮白袜臭脚体育生:老板:都给工作机会了还想要工资,哪来这么多好事
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务