用户输出
34
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#69090 | #1121. jwp的幸运集合(弱化版) | Accepted | 100 | 42 ms | 384 K | C++ 11 / 764 B | 该起什么名字 | 2022-04-26 2:04:00 |
#include <bits/stdc++.h>
#define F(i, n, m) for (int i = n; i < m; i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
inline int read() {
int num = 0;
char c;
bool flag = false;
while ((c = getchar()) == ' ' || c == '\n' || c == '\r')
;
if (c == '-')
flag = true;
else
num = c - '0';
while (isdigit(c = getchar())) num = num * 10 + c - '0';
return (flag ? -1 : 1) * num;
}
int a[30], ans;
int n;
void dfs(int i, int sum, int num) {
if (i == n) {
if (sum == 0 && num % 2 == 0 && num != 0)
ans++;
return;
}
dfs(i + 1, sum, num);
dfs(i + 1, sum + a[i], num + 1);
}
int main() {
std::ios::sync_with_stdio(false);
n = read();
F(i, 0, n) a[i] = read();
dfs(0, 0, 0);
cout << ans;
return 0;
}
用户输出
34
系统信息
Exited with return code 0
用户输出
69
系统信息
Exited with return code 0
20
50000000 -50000000 50000000 -50000000 50000000 -50000000 50000000 -50000000 50000000 -50000000 50
<93 bytes omitted>
用户输出
184755
系统信息
Exited with return code 0
20
50000000 50000000 50000000 50000000 50000000 50000000 50000000 50000000 50000000 50000000 5000000
<82 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
用户输出
255
系统信息
Exited with return code 0