Submission #3385

#TimeUsernameProblemLanguageResultExecution timeMemory
3385mjy0503Inherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include <stdio.h> #include <algorithm> #include <string.h> #include <vector> int n; #define MOD 1000000007 int main(){ int i,next; long long pre=0,fir=0,fac=1; scanf("%d",&n); pre=0; for(i=0;i<n;i++){ scanf("%d",&next); if(i!=0) fac*=i; fac%=MOD; fir+=fac; fir%=MOD; pre*=(i+1); pre+=next-1; pre%=MOD; printf("%lld\n",(fir+pre)%MOD); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...