题解 | #小乐乐改数字#
小乐乐改数字
http://www.nowcoder.com/practice/fcd30aac9c4f4028b23919a0c649824d
#include<stdio.h> #include<math.h> int main() { int i = 0; int num = 0; int ret = 0; int j = 0; int sum = 0; while (~scanf("%d", &i)) {
int tmp = i;
while (tmp)
{
ret = tmp % 10;
if (ret % 2 == 0)
{
ret = 0;
}
else
{
ret = 1;
}
tmp = tmp/ 10;
num = 0;
if (num != i)
{
num = pow(10,j++);
sum += ret*num;
}
}
printf("%d",sum);
}
return 0;
}