Submission #3410

#TimeUsernameProblemLanguageResultExecution timeMemory
3410Apple_CplusInherited disease (kriii1_I)C++98
1 / 1
0 ms1672 KiB
#include <stdio.h> #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <sstream> #include <set> #include <map> #include <stack> #include <cmath> #include <cstdlib> #include <cstring> #include <string> using namespace std; #define MOD 1000000007ll #define ll long long int D; int a[111]; int main() { scanf("%d",&D); for(int i=0;i<D;++i) scanf("%d",a+i); ll cur = 0, x = 1, tot = 1; ll level = 1; printf("1\n"); for(int i=1;i<D;++i) { cur = (max(0ll,x-1)*(i+1) % MOD + a[i] + tot) % MOD; printf("%I64d\n",cur); x = (max(0ll,x-1)*(i+1) + a[i]) % MOD; level = (level * (i+1)) % MOD; tot = (tot + level) % MOD; } }
#Verdict Execution timeMemoryGrader output
Fetching results...