#include<stdio.h>
#define M 1000000007LL
int n;
long long int a[100009];
long long int f[100009];
long long int g[100009];
long long int s,t,u;
int main()
{
scanf("%d",&n);
long long int i,j, k;
f[0] = 1;
g[0] = 1;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
s = (s+a[i])%M;
t = (t+a[i]*a[i])%M;
}
g[1] = 1;
for(i=2;i<=n;i++)
{
g[i] = (g[i-1]*(i*(i-1)))%M;
}
u = (s*s-t)%M;
u = (u * (M/2+1))%M;
printf("%lld\n%lld\n",u,g[n]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3432 KB |
Output is correct |
2 |
Correct |
0 ms |
3432 KB |
Output is correct |
3 |
Correct |
0 ms |
3432 KB |
Output is correct |
4 |
Correct |
0 ms |
3432 KB |
Output is correct |
5 |
Incorrect |
0 ms |
3432 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |