Submission #3686

#TimeUsernameProblemLanguageResultExecution timeMemory
3686pmpmpInherited disease (kriii1_I)C++98
1 / 1
0 ms1676 KiB
#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 timeMemoryGrader output
Fetching results...