Submission #9845

#TimeUsernameProblemLanguageResultExecution timeMemory
9845effservUniting (kriii2_U)C++98
1 / 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 = 0x7fffffffffffffff; ll S = 1; for (int i = N; i >= 1; i--) { S*= (ll)i; S %= bigmod; } printf("%lld\n", S%mod); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...