Submission #3096

#TimeUsernameProblemLanguageResultExecution timeMemory
3096tncks0121Inherited disease (kriii1_I)C++98
1 / 1
0 ms1088 KiB
#include <stdio.h> typedef long long ll; const ll MOD = 1000000007; int D; ll sum, fac, nd; int main() { int i, j, k; scanf("%d", &D); fac = 1; for(i = 1; i <= D; i++) { scanf("%d", &k); --k; // x 레벨에 x! 개의 노드가 있음 sum += fac; sum %= MOD; fac *= i; fac %= MOD; nd -= sum; nd += MOD; nd %= MOD; nd *= i; nd %= MOD; nd += k + sum + fac; nd %= MOD; printf("%lld\n", nd); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...