Submission #3502

#TimeUsernameProblemLanguageResultExecution timeMemory
3502pl0892029Inherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include <cstdio> #define mod 1000000007 int main() { int n; scanf("%d",&n); long long factorial[101] = {1}; long long rightNodeValue[101] = {0}; for(int i=1;i<=n;i++) factorial[i] = factorial[i-1]*i%mod; for(int i=1;i<=n;i++) rightNodeValue[i] = (rightNodeValue[i-1] + factorial[i])%mod; long long leftNum = 0; for(int i=1;i<=n;i++) { leftNum = (leftNum*i)%mod; long long choice; scanf("%lld",&choice); printf("%lld\n",(rightNodeValue[i-1] + leftNum + choice)%mod); leftNum = leftNum + choice - 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...