我们细细观察 边长每多1个就多出2*i-1个边长为1的三角形,然后有1加到i-1个
大三角形再加上上一个三角形的个数
再求倒三角形
从4开始到n是边长为2的三角
从6开始是边长为3
求前n项和即可
//78 25
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
typedef long long ll;
ll b[20210412];
ll c[20210412];
int main()
{
int i,a=1,n=20210411,ans=0,j;
b[1]=1;
for(i=1; i<n; i++)
c[i]=(i+c[i-1])%mod;
for(i=2; i<=n; i++)
{
b[i]=i*2-1;
b[i]=(c[i-1]+b[i])%mod;
b[i]=(b[i]+b[i-1])%mod;
}
ll sum=0;
sum=b[n]%mod;
ll l=4;
a=n;
while(l<=a)
{
ll k=a-l+1;
sum=(sum+k*(k+1)/2)%mod;
l=l+2;
}
printf("%lld\n",sum%mod);
return 0;
}
//