qwq为什么WA了……一分都不给

P1087 [NOIP2004 普及组] FBI 树

```cpp #include<bits/stdc++.h> using namespace std; const int MAXN=1<<12; char a[MAXN]; int n,len=1; void build(int root) { if(root>=len) return ; build(root<<1); build(root<<1|1); if(a[root<<1]==a[root<<1|1]) a[root]=a[root<<1]; else a[root]='F'; } int sum=0; void hx(int root) { if(a[root<<1]==0) { cout<<a[root]; return ; } hx(root<<1); hx(root<<1|1); cout<<a[root]; return; } int main() { scanf("%d",&n); for(int i=1;i<=n;++i) len=len*2; int n1=len; char r=getchar(); for(int i=1;i<=len;++i) { char c=getchar(); if(c=='1') a[n1++]='I'; if(c=='0') a[n1++]='B'; } build(1); hx(1); return 0; } ```
by Thosaka_Forest @ 2018-07-17 15:33:36


root<<1|1 蒟蒻问一句,有没有可能root<<1为奇数? 那么root<<1|1 和 root<<1就一样了 弱弱的问一句
by 良知 @ 2018-07-20 10:54:50


@[zcrrzcr](/space/show?uid=25313) root<<1的意思就是root*2,对应root的左儿子,root<<1|1意思是root*2+1,对应root的右儿子
by Thosaka_Forest @ 2018-07-31 14:12:19


@[g21glf](/space/show?uid=31639) 那并没有看出什么问题啊
by 良知 @ 2018-07-31 14:44:11


@[zcrrzcr](/space/show?uid=25313) 对啊我也没看出来QwQ
by Thosaka_Forest @ 2018-08-01 11:40:59


|