/* -*- coding: utf-8 -*- * * 40.cc: No.40 螟夐・シ上・蜑イ繧顔ョ・- yukicoder */ #include #include using namespace std; /* constant */ const int MAX_D = 10000; /* typedef */ /* global variables */ int as[MAX_D + 1]; /* subroutines */ /* main */ int main() { int d; scanf("%d", &d); for (int i = 0; i <= d; i++) scanf("%d", as + i); // (1) f(0)=b0 // (2) f(1)=b0+b1+b2 // (3) f(-1)=b0-b1+b2 // (2)+(3)=f(1)+f(-1)=2b0+2b2 -> b2=(f(1)+f(-1)/2-b0 // (2)-(3)=f(1)-f(-1)=2b1 -> b1=(f(1)-f(-1))/2 int f0 = as[0], f1 = 0, f2 = 0; for (int i = 0; i <= d; i++) { f1 += as[i]; f2 += (! (i & 1)) ? as[i] : -as[i]; } int b0 = f0; int b1 = (f1 - f2) / 2; int b2 = (f1 + f2) / 2 - b0; if (b2 != 0) printf("2\n%d %d %d\n", b0, b1 ,b2); else if (b1 != 0) printf("1\n%d %d\n", b0, b1); else printf("0\n%d\n", b0); return 0; }