提交时间:2024-03-11 13:40:52

运行 ID: 137551

#include<bits/stdc++.h> using namespace std; int main() { int n,total=0,a[10001]; long long s,t; cin>>n>>s>>t; for(int i=s;i<=t;i++) { int m=0; int d; d=i; for(int j=1;j<=50;j++) { a[j]=d%2; if(a[j]==1)m++; d=d/2; } if(m<=n)total++; } cout<<total; }