怼JAVA第一周,MOCC作业

import java.util.Scanner;


import javax.swing.plaf.synth.SynthStyle;


public class Main {


public static void main(String[] args) {
// TODO Auto-generated method stub
int num;
int a=1;
int b;
int c=0;
int f=1;
Scanner in = new Scanner(System.in);
num=in.nextInt();
while(num!=0)
{
if((num%2)==(a%2))
{
b=f;
}
else
{
b=0;
}
a=a+1;
c=c+b;
b=0;
num=num/10;
f=f*2;
}
System.out.println(c);
}
}

你可能感兴趣的:(怼JAVA第一周,MOCC作业)