Skip to content

Commit 2e7505f

Browse files
authored
math
1 parent f20466d commit 2e7505f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

AtCoder/agc020_c.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//category : math
2+
3+
#include <stdio.h>
4+
#include <bitset>
5+
using namespace std;
6+
int main(){
7+
int i;
8+
int N;
9+
int A;
10+
int S = 0;
11+
bitset<2000 * 2000> bs;
12+
bs[0] = 1;
13+
14+
for (scanf("%d", &N); N--;){
15+
scanf("%d", &A);
16+
bs |= (bs << A);
17+
S += A;
18+
}
19+
20+
S = (S >> 1) + (S & 1);
21+
while (!bs[S]) S++;
22+
printf("%d",S);
23+
24+
return 0;
25+
}
26+

0 commit comments

Comments
 (0)