1001. A+B Format (20)
#include<stdio.h> #include<string.h> int main() { int a,b,c; int j; char buff[100]; char ss[100]; int n; scanf("%d%d",&a,&b); c=a+b; if(c<0) sprintf(buff,"%d",-c); else sprintf(buff,"%d",c); if(c<0) printf("-"); n=strlen(buff); for(int i=0;i<n;i++) { printf("%c",buff[i]); if((n-i-1)%3==0&&(n-i)>3) printf(","); } }

浙公网安备 33010602011771号