#include<stdio.h>
int n, S, a, R, i;
long long R2 = 1, Mod = 1000000007;
int main()
{
scanf("%d", &n);
for (i = 1; i <= n; i++){
scanf("%d", &a);
R += S*a;
S += a;
R2 = R2 * i % Mod;
if (i != n)R2 = R2 * i % Mod;
}
printf("%d\n%lld\n", R, R2);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
6 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |