题解 | #找零#
找零
https://www.nowcoder.com/practice/944e5ca0ea88471fbfa73061ebe95728
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count=0; int x=in.nextInt(); int y=1024-x; while(y>0){ count++; if(y>=64){ y-=64; } else if(y>=16){ y-=16; } else if(y>=4){ y-=4; } else if(y>=1){ y-=1; } } System.out.println(count); } }