제출 #505034

#제출 시각아이디문제언어결과실행 시간메모리
505034lethinh05캥거루 (CEOI16_kangaroo)C++11
6 / 100
1 ms332 KiB
#include <bits/stdc++.h> #define oo 1000000007 #define ll long long #define ld long double #define ii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define vi vector<int> #define vii vector<ii> #define sz(a) (int)(a.size()) #define pb push_back #define fto(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) #define fdto(i, a, b) for (int i = (int)(a); i >= (int)(b); --i) #define bug(x) "["#x" = "<<(x)<<"] " #define maxN 2005 using namespace std; int n, cs, cf; ll f[maxN][maxN]; int main() { #ifndef EVAL freopen("CEOI16_kangaroo.INP", "r", stdin); freopen("CEOI16_kangaroo.OUT", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> cs >> cf; f[1][1] = 1; fto(i, 2, n) { fto(j, 1, i) { if (i == cs || i == cf) { f[i][j] = f[i-1][j-1] + f[i-1][j]; } else { f[i][j] = f[i-1][j-1]*(j - (i > cs) - (i > cf)) + f[i-1][j+1]*j; } } } cout << f[n][1] << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...