TLE加WA
  • 板块题目总版
  • 楼主DevilsFlame
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/12/27 12:48
  • 上次更新2023/12/27 13:08:33
查看原帖
TLE加WA
1050431
DevilsFlame楼主2023/12/27 12:48

题目

#include<bits/stdc++.h>
using namespace std;
long long n,l,r,ans,z;
void fc(long long x){
	if(x<2){
		z++;
		if(z>=l&&z<=r&&x==1)
			ans++;
		return;
	}
	if(z>r)
		return;
	fc(x/2);
	if(z>r)
		return;
	fc(x%2);
	if(z>r)
		return;
	fc(x/2);
	return;
}
int main(){
//	freopen("count.in","r",stdin);
//	freopen("count.out","w",stdout);
	cin>>n>>l>>r;
	if(n<2){
		cout<<n;
		return 0;
	}
	fc(n/2);
	fc(n%2);
	fc(n/2);
	cout<<ans<<endl;
	return 0;
}
2023/12/27 12:48
加载中...