Submission #3400

#TimeUsernameProblemLanguageResultExecution timeMemory
3400QwazInherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include <cstdio> const int MAX=110, MOD=1000000007; typedef long long ll; int n, data[MAX]; void input(){ scanf("%d", &n); int i; for(i=1; i<=n; i++) scanf("%d", &data[i]); } void solve(){ ll cnt=0, all=1, front=0; int i; for(i=1; i<=n; i++){ front = front*i+data[i]-1; cnt += all; all = all*i; front %= MOD; cnt %= MOD; all %= MOD; printf("%lld\n", (cnt+front)%MOD); } } int main(){ input(); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...