#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <list>
#include <string>
#include <sstream>
#include <cstring>
#include <ctime>
#include <set>
#include <cstdio>
#include <stack>
#include <climits>
#include <functional>
#include <locale>
using namespace std;
#define LL long long
#define LD long double
#define FOR(i, l) for(int i = 0; i < l; i++)
#define pb push_back
#define SWAP(a, b), {int temp = a; a = b; b = temp;}
#define parsestr(from, findtar) substr(from, distance(in.begin()+from, find(in.begin()+from, in.end(), findtar)))
#define PI acos(0.0) * 2.0
#define undefined -1
#define MOD 1000000007
#define MAXSIZE (1<<15)+1
LL D[101] = {};
LL ind(int num){
if(num == 0) return 0;
else return D[num-1];
}
LL Mabs(LL num){
while(num < 0) num += MOD;
return num;
}
int main(){
D[0] = 0;
D[1] = 1;
for(int i = 2; i < 101; i++){
D[i] = ((D[i-1]%MOD) * i)%MOD;
}
for(int i = 2; i < 101; i++){
D[i] += D[i-1];
}
FOR(i, 101){
D[i]++;
}
int h;scanf("%d %*d", &h);
LL ans = 1;
printf("1\n");
for(int i = 1; i < h; i++){
int index;scanf("%d", &index);
ans = ind(i+1) - 1 + Mabs(ans - ind(i)) * (i + 1) + index;
printf("%lld", ans);
if(i != h-1) printf("\n");
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1672 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1672 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |