답안 #3410

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3410 2013-08-31T05:34:26 Z Apple_Cplus Inherited disease (kriii1_I) C++
1 / 1
0 ms 1672 KB
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
 
using namespace std;

#define MOD 1000000007ll
#define ll long long
int D;
int a[111];

int main() {
	scanf("%d",&D);
	for(int i=0;i<D;++i) scanf("%d",a+i);

	ll cur = 0, x = 1, tot = 1;
	ll level = 1;
	printf("1\n");
	for(int i=1;i<D;++i) {
		cur = (max(0ll,x-1)*(i+1) % MOD + a[i] + tot) % MOD;
		printf("%I64d\n",cur);
		x = (max(0ll,x-1)*(i+1) + a[i]) % MOD;
		level = (level * (i+1)) % MOD;
		tot = (tot + level) % MOD;

	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1672 KB Output is correct
2 Correct 0 ms 1672 KB Output is correct
3 Correct 0 ms 1672 KB Output is correct
4 Correct 0 ms 1672 KB Output is correct
5 Correct 0 ms 1672 KB Output is correct
6 Correct 0 ms 1672 KB Output is correct
7 Correct 0 ms 1672 KB Output is correct
8 Correct 0 ms 1672 KB Output is correct
9 Correct 0 ms 1672 KB Output is correct
10 Correct 0 ms 1672 KB Output is correct
11 Correct 0 ms 1672 KB Output is correct
12 Correct 0 ms 1672 KB Output is correct
13 Correct 0 ms 1672 KB Output is correct
14 Correct 0 ms 1672 KB Output is correct
15 Correct 0 ms 1672 KB Output is correct
16 Correct 0 ms 1672 KB Output is correct
17 Correct 0 ms 1672 KB Output is correct
18 Correct 0 ms 1672 KB Output is correct
19 Correct 0 ms 1672 KB Output is correct
20 Correct 0 ms 1672 KB Output is correct