답안 #3402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3402 2013-08-31T05:31:00 Z Apple_Cplus Inherited disease (kriii1_I) C++
0 / 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];
		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 Incorrect 0 ms 1672 KB Output isn't correct
4 Halted 0 ms 0 KB -