优化以下代码段
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
int main()
{
int t;scanf("%d",&t);
while(t--)
{
int n;scanf("%d",&n);
ll sum=1;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
sum=sum*i%mod*j%mod;
}
}
printf("%lld\n",sum);
}
return 0;
}单组输入 第一行输入一个t,接下来t行,每行输入一个n
t<=10 1≤n≤10^6
输出有t行,即对应代码中的输出
1 1
1