嘛,乱搞一番得到4n*5的n-1次方,然后我们再仔细一看,发现n很小但是T有可能很大,于是我们机智的打个表就行(偷了个表)
#include<bits/stdc++.h> using namespace std; int anss[]={0,0,40,300,2000,458,741,1981,1285,1458,518,842,1491,1888,1675,1662,836,929,432,1165,850,1452,1298,764,1281,1738,1411,765,473,1661,771,304,1828,645,890,803,1836,292,1174,426,1001,1367,687,793,790,117,1490,1940,213,1798,613,1320,1889,1946,333,841,85,1902,839,980,867,226,655,900,653,86,591,1753,748,1788,1187,1289,1278,625,391,327,1523,1034,363,1864,1537,882,500,1013,1644,1150,505,384,1250,893,1764,1336,1372,390,1712,1349,795,316,1348,1566,23,}; int main() { int T,n; cin>>T; while(T--) { cin>>n; cout<<anss[n]<<endl; } return 0; }