Submission #3817

#TimeUsernameProblemLanguageResultExecution timeMemory
3817MiNuInherited disease (kriii1_I)C++98
0 / 1
0 ms1672 KiB
#include <iostream> #include <cstdio> using namespace std; #define MOD 1000000007 int main() { int D; scanf("%d", &D); long long first[128] = { 0, 1, 2}; for ( int i=3 ; i<=D ; ++i ) { first[i] = (first[i-1] + (i-1)*(i-2)) % MOD; } long long curr = 0; for ( int i=1 ; i<=D ; ++i ) { int k; scanf("%d", &k); curr = first[i] + (curr - first[i-1]) * i + k - 1; curr %= MOD; printf("%lld\n", curr); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...