Submission #3516

#TimeUsernameProblemLanguageResultExecution timeMemory
3516shinhj88Inherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include<stdio.h> #define P 1000000007 int main(){ long long d, i, di, a=1, b, t, t1=0, t2=1; scanf("%lld", &d); for(i=1;i<=d;++i){ scanf("%lld", &di); b=((a-1)*i+di)%P; printf("%d\n", (b+t1)%P); t1=(t1+t2)%P; t2=(t2*(i+1))%P; a=b; } }
#Verdict Execution timeMemoryGrader output
Fetching results...