用户输出
34
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#28760 | #1121. jwp的幸运集合(弱化版) | Accepted | 100 | 203 ms | 356 K | C++ / 745 B | 机类924-余沛之 | 2020-07-01 10:41:30 |
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdio>
using namespace std;
int main() {
int n;
int a[21];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int cnt = 0;
for (int i = 0; i < (1 << n); i++) {
int sum = 0, num = 0;
for (int j = 0; j < n; j++)
if (i & (1 << j)) {
sum += a[j];
num++;
}
if (sum == 0 && num != 0 && num % 2 == 0) {
cnt++;
}
}
printf("%d\n", cnt);
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