- 数学课做减法
- 2020-02-07 12:47:24 @
#include <bits/stdc++.h>
using namespace std;
long long a,b;
unsigned long long ans,tem;
int k,c[1000],len;
int main()
{
cin>>a>>b;
if (a<b)
{
cout<<"-";
ans=b-a;
}
else ans=a-b;
tem=ans;
//cout<<ans<<endl;
while(tem>0)
{
c[len+1]=tem%10;
tem/=10;
len++;
}
//cout<<len<<endl;
k=len%3;
for(int i=1;len>1&&i<=k;len--,i++)
{
cout<<c[len];
}
cout<<",";
for(int i=1;len>1;len--,i++)
{
cout<<c[len];
if(i%3==0) cout<<",";
}
cout<<c[1]<<endl;
return 0;
}
0 条评论
目前还没有评论...