对于边长为1的立方体,满足题目中的等边三角形的顶点类似于(0,0,0)(1,1,0),(0,1,1)。
对于边长为i的立方体,对答案的贡献为$8*(n-i)^3 $
最后答案为$ sum_{i=1}^{n-1} 8*(n-i)^3=8 imes sum_{i=1}^{n-1} i^3=2 imes(n(n-1)) ^2$
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
#define rep(i,a,b) for(int i=a;i<=b;i++)
int a[N];
const int mod=1e9+7;
typedef long long LL;
LL mul(LL a,LL b)
{
return (a%mod)*(b%mod)%mod;
}
LL qmi(LL a,LL b)
{
LL res=1;
while(b)
{
if(b&1) res=mul(res,a);
a=mul(a,a);
b>>=1;
}
return res;
}
int main()
{
int t;
cin>>t;
while(t--)
{
LL n;
cin>>n;
if(n%2)
{
LL temp=mul(n,(n-1)/2);
LL res=mul(8,mul(temp,temp));
printf("%lld
",res);
}
else
{
LL temp=mul(n/2,n-1);
LL res=mul(8,mul(temp,temp));
printf("%lld
",res);
}
}
}