题解 | #找零#
找零
http://www.nowcoder.com/practice/944e5ca0ea88471fbfa73061ebe95728
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = 1024 - sc.nextInt();
int cnt = 0;
while(N >= 1024) {
N -= 1024;
cnt++;
}
while(N >= 64) {
N -= 64;
cnt++;
}
while(N >= 16) {
N -= 16;
cnt++;
}
while(N >= 4) {
N -= 4;
cnt++;
}
while(N >= 1) {
N--;
cnt++;
}
System.out.println(cnt);
}
}