题解 | #添加逗号#
添加逗号
http://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include<stdio.h> int main() { long long n; int c=0,i=0,j; int s[100]={0}; scanf("%lld",&n); while(n) { s[i]=n%10; n=n/10; i++; } if(i%3==0) c=i+i/3-1; else c=i+i/3; for(j=i-1;j>=0;j--) { if(c%4==0 && c!=i+i/3) { printf(","); j++; } else { printf("%d",s[j]); } c--; } return 0; }