Submission #3606

#TimeUsernameProblemLanguageResultExecution timeMemory
3606wclee2265Inherited disease (kriii1_I)C11
1 / 1
0 ms1088 KiB
#include <stdio.h> #define MOD 1000000007 #define N 105 int n; long long d[N]; int main() { int i,j; long long total=1,tmp,t=1; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%lld",&d[i]); for(j=1,tmp=0;j<i;j++) { d[j]*=i; d[j]%=MOD; tmp+=d[j]; tmp%=MOD; } printf("%lld\n",(total+tmp+d[i]-1)%MOD); d[i]--; t*=i; t%=MOD; total+=t; total%=MOD; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...