Submission #3629

#TimeUsernameProblemLanguageResultExecution timeMemory
3629imsifileInherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include<stdio.h> long long n, x, fr, rr, t, i; int main(){ scanf("%lld", &n); for(i=0; i<n; i++){ scanf("%lld", &t); x+=fr*(i+1)+rr+t, x%=1000000007; fr=fr*(i+1)+t-1, fr%=1000000007; rr=rr*(i+1)+i+1-t, rr%=1000000007; printf("%lld\n", x); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...