#include <bits/stdc++.h>
using namespace std;
int n, l , r, cnt;
string dfs(int x) {
if(x / 2 == 0 || x / 2 == 1) {
int pos = x / 2;
char sss = (pos + '0');
string ss = "";
char t = x % 2 + '0';
ss += (sss + t + sss);
return ss;
}
else {
string t = dfs(x / 2);
string ss = "";
int pos2 = x % 2;
char k = pos2 + '0';
ss += t + k + t;
return ss;
}
}
int main () {
//freopen("diff.in", "r", stdin);
//freopen("diff.out", "w", stdout);
cin >> n >> l >> r;
/**
string j = dfs(n);
int pos3 = n % 2;
char g = (n % 2 + '0');
string s = "";
s += (j + g + j);
**/
string s = dfs(n);
//cout << s << '\n';
for(int i = l; i <= r; i++)
if(s[i] == '1') cnt++;
cout << cnt << '\n';
return 0;
}
所以为什么挂了