Files
python/LuoGu/RuMen/P2415.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

19 lines
446 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}