#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b); int sum=a+b; if(sum<0) { printf("-"); sum=-sum; } if(sum>1000000) //【思维】,两个数字在:-1000000 <= a, b <= 1000000,之和不会超过1000000再加三个0的数量级 printf("%d,%d,%d",sum/1000000,sum%1000000/1000,sum%1000); else if(sum>1000) printf("%d,%d",sum/1000,sum%1000); else printf("%d",sum); return 0; }
转载于:https://www.cnblogs.com/Evence/p/4296982.html