Submission #10061

#TimeUsernameProblemLanguageResultExecution timeMemory
10061effservUniting (kriii2_U)C++98
4 / 4
12 ms1088 KiB
#include <cstdio> #include <algorithm> using namespace std; typedef long long ll; int main() { int N; scanf("%d", &N); ll a; scanf("%lld", &a); ll A = (ll)a; ll C = 0; for (int i = 0; i < N - 1; i++) { scanf("%lld", &a); C += A*a; A += a; } printf("%lld\n", C); ll mod = 1000000007; ll bigmod = 1e13; ll S = N; for (int i = N - 1; i >= 1; i--) { S *= (ll)i; S %= mod; S *= (ll)i; S %= mod; } printf("%lld\n", S%mod); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...