题解 | #小乐乐改数字#
小乐乐改数字
https://www.nowcoder.com/practice/fcd30aac9c4f4028b23919a0c649824d
#include <stdio.h> #include <math.h> int main() { long long a = 0; scanf("%lld", &a); int count = 1; long long c = a; long long sum = 0; int i = 0; while (c / 10) { count++; c /= 10; } c = a; for (i = 0; i < count; i++) { int low = c % 10; if (low%2==0) { low = 0; sum +=(long long)pow(10, i)*low; } if (low % 2 != 0) { low = 1; sum += (long long)pow(10, i)*low; } c = c / 10; } printf("%lld\n", sum); return 0; }