제출 #96902

#제출 시각아이디문제언어결과실행 시간메모리
96902Kastanda캥거루 (CEOI16_kangaroo)C++11
100 / 100
19 ms14336 KiB
// 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) 메시지

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &s, &f);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...