题解 | #添加逗号#
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include <stdio.h>
#include <string.h>
int main() {
char num[10];
while (scanf("%s", num) != EOF) { // 注意 while 处理多个 case
// 64 位输出请用 printf("%lld") to
int z = strlen(num);
for (int i = 0; i < z; i++) {
if (i % 3 == z % 3 && i != 0)
printf(",");
printf("%c", num[i]);
}
}
return 0;
}
查看14道真题和解析

