# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3686 | pmpmp | 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 <algorithm>
#include <stdio.h>
long long dd, h[200], hh[200];
int main ()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int a, b, c, d;
int i, j, k;
hh[0]=1; h[0]=0;
for(i=1;i<=100;i++){hh[i]=hh[i-1]*i; hh[i]=hh[i]%1000000007; }//printf("(%lld\n", hh[i]);}
for(i=1;i<=100;i++){h[i]=h[i-1]+hh[i-1]; h[i]=h[i]%1000000007; }//printf("%lld\n", h[i]);}
//printf("//%lld\n", 1000000006*1000000006);
scanf("%d", &a);
for(i=1;i<=a;i++)
{
scanf("%d", &d);
//dd=( ( (h[i]-1)%1000000007 ) + d%1000000007 + ( ( (dd*1000000007-h[i-1]) % 1000000007 ) * i ) % 1000000007 ) % 1000000007;
dd=( ( (h[i]-1)%1000000007 ) + d%1000000007 + ( ( (dd%1000000007-h[i-1]%1000000007+1000000007) % 1000000007 ) * i ) % 1000000007 ) % 1000000007;
printf("%lld\n", dd);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |