foo.cc: In function 'int main()':
foo.cc:22:20: error: 'n' was not declared in this scope
for(int i=1;i<=n;i++)
^
foo.cc:28:10: error: request for member 'bh' in 'a[1]', which is of non-class type 'int'
a[1].bh=1;
^~
foo.cc:31:19: error: request for member 'bh' in 'a[i]', which is of non-class type 'int'
if(i%2!=0) a[i].bh=i/2+1;
^~
foo.cc:32:13: error: request for member 'bh' in 'a[i]', which is of non-class type 'int'
else a[i].bh=n1+n2-i/2+1;
^~
foo.cc:35:21: error: request for member 'bh' in 'a[i]', which is of non-class type 'int'
ans+=a[i]*a[i].bh;
^~
[Hydro](https://hydro.ac)提供评测服务