# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
96902 | Kastanda | 캥거루 (CEOI16_kangaroo) | C++11 | 19 ms | 14336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// I do it for the glory
#include<bits/stdc++.h>
using namespace std;
const int N = 2059, Mod = 1e9 + 7;
int dp[N][N];
int main()
{
int n, s, f;
scanf("%d%d%d", &n, &s, &f);
int cnt = 0; dp[0][0] = 1;
for (int i = 1; i <= n; cnt += (i == s || i == f), i++)
for (int j = 1; j <= i; j++)
{
if (i == s || i == f)
dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % Mod;
else
dp[i][j] = (1LL * dp[i - 1][j + 1] * j + 1LL * dp[i - 1][j - 1] * (j - cnt)) % Mod;
}
return !printf("%d\n", dp[n][1]);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |