# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3672 | solveit | Inherited disease (kriii1_I) | C++98 | 0 ms | 1676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |