제출 #20076

#제출 시각아이디문제언어결과실행 시간메모리
20076gs13068목공 (kriii4_A)C++98
4 / 100
24 ms1104 KiB
#include <cstdio>
#include <map>

const int p = 1092616193;

using namespace std;

int f(int x, int y)
{
	return y & 1 ? (long long)f(x, y ^ 1)*x%p : y ? f((long long)x*x%p, y >> 1) : 1;
}

int a[1001];
int d[5005];

int main()
{
	int i, j, n, m, t, s = 0;
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
	{
		scanf("%d", a + i);
		s += a[i];
	}
	s = f(s, p - 2);
	for (i = n; i <= m; i++)
	{
		t = 0;
		for (j = 0; j < n; j++) t = (t + (long long)a[j] * d[i + j - n]) % p;
		d[i] = ((long long)t * s + 1) % p;
	}
	printf("%d", d[m]);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...