题解 | #小乐乐改数字#
小乐乐改数字
https://www.nowcoder.com/practice/fcd30aac9c4f4028b23919a0c649824d
#include <stdio.h> #include <string.h> char s[15]; int main() { int n; scanf("%d", &n); sprintf(s, "%d", n); for (int i = 0; i < strlen(s); i ++ ) { if ((s[i] - '0') % 2 == 0) s[i] = '0'; else s[i] = '1'; } int res = 0; for (int i = 0; i < strlen(s); i ++ ) { res = res * 10 + (s[i] - '0'); } printf("%d", res); return 0; }