# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3385 | mjy0503 | Inherited disease (kriii1_I) | C++98 | 0 ms | 1088 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 <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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |