题目:P2415 集合求和
就#5对了
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll ans=0;
ll s[35];
void marge(ll l,ll r)
{
if(l==r) {
ans+=s[l];
return ;
}
int mid=(l+r)>>1;
marge(l,mid); marge(mid+1,r);
for(int i=l;i<=r;i++) ans+=s[i];
}
int main()
{
ios::sync_with_stdio(false);
cout.tie(0);cin.tie(0);
int i=0;
while(cin>>s[++i]);
marge(1,i);
cout<<ans;
return 0;
}