Submission #9616

#TimeUsernameProblemLanguageResultExecution timeMemory
9616jaehadadUniting (kriii2_U)C++14
4 / 4
28 ms1672 KiB
#include<cstdio> #include<cassert> #include<cstring> #include<map> #include<set> #include<time.h> #include<algorithm> #include<stack> #include<queue> #include<utility> #include<cmath> #include<iostream> #include<string> #include<vector> using namespace std; const long long MOD = 1000000007; long long go(long long n) { long long ret = 1; for(long long i = 2; i <= n; ++i) { ret = (ret * i) % MOD; } for(long long i = 2; i <= n-1; ++i) { ret = (ret * i) % MOD; } return ret; } int main() { long long n; cin >> n; long long ret = 0; long long cursize = 0; for(int i = 0; i < n; ++i) { long long s; cin >> s; ret += cursize * s; cursize += s; } cout << ret << endl; cout << go(n) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...