- 二进制回文串GESP202603 三级T1
- @ 2026-04-05 08:48:22
#include <bits/stdc++.h>
using namespace std;
int n,x,a[32005],ok=1,cnt,t;
int main(){
cin>>n;
for(int j=1;j<=n;j++)
{
t=j;
while(t)
{
a[++x]=t%2;
t/=2;
}
for(int i=1;i<=x/2;i++)
if(a[i]!=a[x+1-i])
{
ok=0;
break;
}
cnt+=ok;
}
cout<<cnt;
return 0;
}
1 条评论
-
202603zj08王宇浩 (王宇浩) LV 8 @ 2026-04-05 12:47:20
这是什么?
- 1
信息
- ID
- 3051
- 难度
- 5
- 分类
- (无)
- 标签
- 递交数
- 77
- 已通过
- 24
- 通过率
- 31%
- 上传者