Nerde Nolzda

ZeroJudge: a042 平面圖形切割

將遞迴式 a1 = 2, an = an-1 + 2n - 2 展開。
Solve the recursive equation a1 = 2, an = an-1 + 2n - 2.

ZeroJudge Link (Zh)

#include <stdio.h>

main() {
  int num;
  while (scanf("%d", &num) != EOF) {
    printf("%d\n", 2 + num * (num + 1) - 2 * num);
  }
  return 0;
}

Related Posts

0 comments

Post a comment

Send an email to comment@nerde.pw.