题解

一二之殇...二九之主  •  1年前


include <stdio.h>

int main() {

int a, b, c, i;
b = 0;
c = 0;
char str[30];
scanf("%s", str);
for (i = 0; i < 30; i++) {
	a = str[i] - '0';
	if (a >= 0 && a <= 9) {
		if (a % 2 == 0) {
			b++;
		} else {
			c++;
		}
	}
}
printf("%d %d", c, b);
return 0;

}


评论:

请先登录,才能进行评论