There are n (n≤500) of straight lines, which are known to p (p≥2) straight lines intersect at the same point in the same plane, the straight line n which can be divided into a maximum number of distinct planar regions?
int f[N]; f[p]=2*p; for(int i=p+1;i<=n;i++)f[i]=f[i-1]+i;