Submission #9325

#TimeUsernameProblemLanguageResultExecution timeMemory
9325myungwooUniting (kriii2_U)C++14
4 / 4
12 ms1088 KiB
#include<stdio.h> #define mod 1000000007 typedef long long lld; lld n, s, sum, sqsum, fac=1; int main(){ lld i; scanf("%lld", &n); for(i=0; i<n; i++){ scanf("%lld", &s); sum+=s, sqsum+=s*s; } for(i=n; i>=2; i--){ fac=(fac*i)%mod; fac=(fac*(i-1))%mod; } printf("%lld\n%lld", (sum*sum-sqsum)/2, fac); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...