func_code_string: #include <bits/stdc++.h>   using namespace std;   int arr[20];   int mem[20][20][20];   int n, a, b;   int calc(int ind, int p, int c) {     int x0 = arr[ind - 1] - p, x1 = arr[ind] - c, x2 = arr[ind + 1];     int& res = mem[ind][p][c];     if (res != -1) return res;     if (ind == n - 2) {       res = 0;       while (x0 >= 0 || x1 >= 0 || x2 >= 0) {         ++res;         x0 -= b;         x2 -= b;         x1 -= a;       }       return res;     }     res = ((int)1e9);     int cnt = 0;     while (x0 >= 0) {       ++cnt;       x0 -= b;       x2 -= b;       x1 -= a;     }     res = min(res, cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2));     while (x0 >= 0 || x1 >= 0 || x2 >= 0) {       ++cnt;       x0 -= b;       x2 -= b;       x1 -= a;       res = min(res, cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2));     }     return res = min(res, cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2));   }   int sol[20 * 20 * 20];   int sz;   void build(int ind, int p, int c) {     int x0 = arr[ind - 1] - p, x1 = arr[ind] - c, x2 = arr[ind + 1];     if (ind == n - 2) {       while (x0 >= 0 || x1 >= 0 || x2 >= 0) {         sol[sz++] = ind + 1;         x0 -= b;         x2 -= b;         x1 -= a;       }       return;     }     int cnt = 0;     while (x0 >= 0) {       sol[sz++] = ind + 1;       ++cnt;       x0 -= b;       x2 -= b;       x1 -= a;     }     if (calc(ind, p, c) ==         cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2)) {       build(ind + 1, arr[ind] - x1, arr[ind + 1] - x2);       return;     }     while (x0 >= 0 || x1 >= 0 || x2 >= 0) {       ++cnt;       x0 -= b;       x2 -= b;       x1 -= a;       sol[sz++] = ind + 1;       if (calc(ind, p, c) ==           cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2)) {         build(ind + 1, arr[ind] - x1, arr[ind + 1] - x2);         return;       }     }     if (calc(ind, p, c) ==         cnt + calc(ind + 1, arr[ind] - x1, arr[ind + 1] - x2)) {       build(ind + 1, arr[ind] - x1, arr[ind + 1] - x2);       return;     }   }   int main() {     while (scanf( %d%d%d , &n, &a, &b) != -1) {       for (int i = 0; i < n; ++i) scanf( %d , arr + i);       memset(mem, -1, sizeof mem);       int res = calc(1, 0, 0);       printf( %d n , res);       sz = 0;       build(1, 0, 0);       for (int i = 0; i < sz; ++i) printf(i ?   %d  :  %d , sol[i]);       printf(  n );       fflush(stdout);     }     return 0;   }   