You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
446 B

2 years ago
#include<bits/stdc++.h>
using namespace std;
int a[31], i = 0, j;
long long s = 0;
int main() {
//录入进来终止条件是CTRL+D最起码在CLion里是这样的
while (cin >> a[i++]);
//一次性和
for (j = 0; j < i; j++) {
s += a[j];
}
//规律~
s *= pow(2, i - 2);//注意i-2! 之所有是i-2是因为你已经使用过一次本来是i-1
cout << s;
return 0;
}