Submission #9684

#TimeUsernameProblemLanguageResultExecution timeMemory
9684shashackUniting (kriii2_U)C++98
1 / 4
28 ms9364 KiB
#include<iostream> using namespace std; int main(){ int n; cin >> n; long long val[1000000+1]; for (int i = 0; i < n; i++){ cin >> val[i]; } long long ret = 0; for (int i = 1; i < n; i++){ ret += val[i] * val[i - 1]; val[i] = val[i] + val[i - 1]; } int count = 1; for (int i = n; i >= 2; i--){ count = (((count % 1000000007) * (i) % 1000000007) * (i - 1)) % 1000000007; } cout << ret << endl << count << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...