2019-05-05
2019-05-05 本文已影响0人
幻无虚生
数字特征值
image.png
- 0 是偶数
#include <stdio.h>
int main(){
int number = 0;
scanf("%d",&number);
int stage =0;
int a=0;
int b=0;
int c=0;
int d=0;
int e=1;
int count=0;
int sum=0;
while(number>0){
count++;
a = number%10;
number=number/10;
if(a>0)
{
if((a%2==count%2))
{
b=1;
}
else
{
b=0;
}
}
else
{
if((a%2==count%2))
{
b=1;
}
else
{
b=0;
}
}
if(count==1){
d=b*1;
}else{
e=e*2;
d=d+(b*e);
}
}
printf("%d",d);
return 0;
}