/* * douteki.c * * Created on: 2016/09/13 * Author: admin */ #include #include #include #include int main(){ char str[10000]; char *tmp; int n=0, i=0, j=0; int sum_w=0, half=0; int w[100] = {0}; int check[10001] = {0}; check[0] = 1; fgets(str, sizeof(str), stdin); n = atoi(str); printf("%d\n", n); fgets(str, sizeof(str), stdin); tmp = strtok(str, " "); w[0] = atoi(tmp); sum_w = w[0]; for(i = 1; i < n; i++){ tmp = strtok(NULL, " "); w[i] = atoi(tmp); sum_w += w[i]; } half = sum_w / 2; printf("%d %d\n", sum_w, half); if(half % 2 == 1){ printf("impossible\n"); goto end; } for(i = 0; i < n; i++){ for(j = sum_w; j >= 0; j--){ if(check[j] == 1){ check[w[i] + j] = 1; } } } if(check[half] == 1){ printf("possible\n"); } else{ printf("impossible\n"); } end: return 0; }