# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3096 | tncks0121 | Inherited disease (kriii1_I) | C++98 | 0 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |