C++ 代码
#include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
int ret = 0;
int a[4] = {64, 16, 4, 1};
N = 1024 - N;
for(int i = 0; i < 4; ++ i){
int cnt = N / a[i];
N -= cnt * a[i];
ret += cnt;
}
cout << ret << endl;
return 0;
}