Submission #3672

#TimeUsernameProblemLanguageResultExecution timeMemory
3672solveitInherited disease (kriii1_I)C++98
1 / 1
0 ms1676 KiB
#include <iostream> #include <string> #include <math.h> #include <sstream> #include <cstdio> #include <algorithm> #include <set> #include <vector> #include <stdio.h> using namespace std; #define MOD 1000000007 #define ll long long int D, A[105]; ll currCnt[105], totalCnt[105]; ll currNum[105]; int main() { scanf("%d",&D); for(int i = 1;i<=D;i++) scanf("%d",&A[i]); currNum[0] = 1; currCnt[0] = 1; for(int i = 1;i<=D;i++) { currCnt[i] = currCnt[i - 1] * i; currCnt[i] %= MOD; totalCnt[i] = totalCnt[i - 1] + currCnt[i]; totalCnt[i] %= MOD; currNum[i] = (currNum[i - 1] - 1) * i + A[i]; currNum[i] %= MOD; printf("%d\n", (totalCnt[i - 1] + currNum[i])%MOD); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...