Submission #9760

#TimeUsernameProblemLanguageResultExecution timeMemory
9760kkjjkkUniting (kriii2_U)C++98
1 / 4
12 ms4020 KiB
#include <algorithm> #include <iostream> #include <cstdio> using namespace std; long long h[100005]; long long f[100005], m = 1000000007, nn[100005]; int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld", &h[i]); f[1] = 1; for(int i = 2; i < 100005; i++) { f[i] = f[i - 1] * i; f[i] %= m; } if(n == 1) { printf("0\n"); printf("1"); } else if(n == 2) { printf("%lld\n", h[0] * h[1]); printf("2"); } else { long long a = h[0] + h[1]; long long b = h[0] * h[1]; long long c, d;//, m = 1000000007; for(int i = 2; i < n; i++) { c = a * h[i]; //c %= m; a += h[i]; b += c; //b %= m; } printf("%lld\n", b); printf("%lld", f[n]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...