# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3410 | Apple_Cplus | Inherited disease (kriii1_I) | C++98 | 0 ms | 1672 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 <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std;
#define MOD 1000000007ll
#define ll long long
int D;
int a[111];
int main() {
scanf("%d",&D);
for(int i=0;i<D;++i) scanf("%d",a+i);
ll cur = 0, x = 1, tot = 1;
ll level = 1;
printf("1\n");
for(int i=1;i<D;++i) {
cur = (max(0ll,x-1)*(i+1) % MOD + a[i] + tot) % MOD;
printf("%I64d\n",cur);
x = (max(0ll,x-1)*(i+1) + a[i]) % MOD;
level = (level * (i+1)) % MOD;
tot = (tot + level) % MOD;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |