#include <cstdio>
const int MOD = 1000000007;
int D, cid[101];
unsigned long long num[101];
void prep() {
num[0] = 0;
num[1] = 1;
for (int i = 2; i <= 100; ++i) {
num[i] = num[i-1];
for (int j = 0; j < i; ++j)
num[i] += (num[i-1] - num[i-2]) % MOD;
}
}
void solve() {
int priv = cid[1];
for (int i = 2; i < D; ++i) {
int cur = (i + 1) * (priv - 1) + priv - 1;
printf("%lld\n", (num[i] + cur) % MOD);
priv = cur;
}
}
int main() {
scanf("%d", &D);
for (int i = 0; i < D; ++i)
scanf("%d", &cid[i]);
prep();
if (D == 1)
printf("%d\n", cid[0]);
else {
printf("%d\n", cid[0]);
printf("%d\n", cid[0]+cid[1]);
if (D >= 3) solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |