foo.cc: In function 'int main()':
foo.cc:6:29: error: 'a' was not declared in this scope
for(int i=1;i<=n;i++) cin>>a[i];
^
foo.cc:12:25: error: 'ans' was not declared in this scope
for(int i=a;i<=b;i++) ans+=a[i];
^~~
foo.cc:12:25: note: suggested alternative: 'abs'
for(int i=a;i<=b;i++) ans+=a[i];
^~~
abs
foo.cc:12:33: error: invalid types 'int[int]' for array subscript
for(int i=a;i<=b;i++) ans+=a[i];
^
foo.cc:13:9: error: 'ans' was not declared in this scope
cout<<ans<<endl;
^~~
foo.cc:13:9: note: suggested alternative: 'abs'
cout<<ans<<endl;
^~~
abs
[Hydro](https://hydro.ac)提供评测服务