- 幸运数字 2024信息与未来T1
- @ 2026-05-30 18:31:29
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;
string s;
string _10to2(int n)
{
s="";
while(n)
{
s=char(n%2+'0')+s;
n/=2;
}
}
int main( )
{
cin>>a>>b;
for (int i=a;i<=b;i++)
{
int it=i;
string a=_10to2(it);
int x=a.find("101");
int y=a.find("010");
if (x==-1 && y==-1)
ans++;
}
cout<<ans;
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 3112
- 难度
- 5
- 分类
- (无)
- 标签
- 递交数
- 54
- 已通过
- 18
- 通过率
- 33%
- 上传者