Submission #8848

#TimeUsernameProblemLanguageResultExecution timeMemory
8848gs13068Uniting (kriii2_U)C++98
4 / 4
12 ms1088 KiB
#include<cstdio> int main() { long long sum,res,cnt; int i,n,a; scanf("%d",&n); sum=res=0; cnt=1; for(i=1;i<=n;i++) { scanf("%d",&a); sum+=a; res-=a*a; if(i>1) { cnt*=i; cnt%=1000000007; cnt*=i-1; cnt%=1000000007; } } printf("%lld\n%lld",(sum*sum+res)/2,cnt); }
#Verdict Execution timeMemoryGrader output
Fetching results...