# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
3686 | pmpmp | Inherited disease (kriii1_I) | C++98 | 0 ms | 1676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <stdio.h>
long long dd, h[200], hh[200];
int main ()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int a, b, c, d;
int i, j, k;
hh[0]=1; h[0]=0;
for(i=1;i<=100;i++){hh[i]=hh[i-1]*i; hh[i]=hh[i]%1000000007; }//printf("(%lld\n", hh[i]);}
for(i=1;i<=100;i++){h[i]=h[i-1]+hh[i-1]; h[i]=h[i]%1000000007; }//printf("%lld\n", h[i]);}
//printf("//%lld\n", 1000000006*1000000006);
scanf("%d", &a);
for(i=1;i<=a;i++)
{
scanf("%d", &d);
//dd=( ( (h[i]-1)%1000000007 ) + d%1000000007 + ( ( (dd*1000000007-h[i-1]) % 1000000007 ) * i ) % 1000000007 ) % 1000000007;
dd=( ( (h[i]-1)%1000000007 ) + d%1000000007 + ( ( (dd%1000000007-h[i-1]%1000000007+1000000007) % 1000000007 ) * i ) % 1000000007 ) % 1000000007;
printf("%lld\n", dd);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |