fork download
  1. #include <stdio.h>
  2. int main() {
  3. int arr[31] = {2, -1};
  4. for (int i = 2; i < 31; i++)
  5. arr[i] = (-1)*arr[i-1]+arr[i-2]+2;
  6. printf("%d", arr[30]);
  7. return 0;
  8. }
Success #stdin #stdout 0.01s 5288KB
stdin
13 30 58 49 38 29 44 12 93 56
stdout
2496122