问题描述

给定正整数pa ,求 p``0`` + p``1`` + p``2`` + ... + p``a

  1. int p, a;
  2. long res = 1;
  3. while (a-- > 0)
  4. res = res * p + 1;

p``1`` + p``2`` + ... + p``a

  1. int p, a;
  2. long res = 1;
  3. while (a-- > 0)
  4. res = res * p + 1;
  5. res -= 1;