#include<stdio.h> int main() { int x=0,m=0,n=0,a=0; do { scanf("%d",&x); a=x%2; if (a==1){//傻子hhhhh==哦 m++; } else if (a==0) { n++; } }while(x!=-1); printf("%d %d",m,n); system("pause"); }
#include<stdio.h> int main() { int i=0,a=0,b=0,n=0,e=0,cf=1,s=0; scanf("%d",&i); while (i/10!=0){ a=i/10; b=i%10; i=a; n++; if (b%2==n%2){ s=n; cf=1; while (s>1){ cf=cf*2; s--; } e=e+cf; } } n++; if (i%2==n%2){ s=n; cf=1; while (s>1){ cf=cf*2; s--; } e=e+cf; } printf("%d",e); system("pause"); }