제출 #960639

#제출 시각아이디문제언어결과실행 시간메모리
960639teo_thrash캥거루 (CEOI16_kangaroo)C++14
6 / 100
1 ms456 KiB
// it is your desire to work hard #include<bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn=2e3+3; const int mod=1e9+7; int n; int dp[maxn][maxn]; int cs, cf; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n; cin>>cs>>cf; dp[1][1]=1; for(int i=2; i<=n; i++){ for(int j=1; j<=i; j++){ int rem=0; if(i>cs) rem++; if(i>cf) rem++; if(i==cs or i==cf){ dp[i][j] = dp[i-1][j-1] + dp[i-1][j]; }else{ dp[i][j] += dp[i-1][j+1]*j + dp[i-1][j-1]*(j-rem); } } } cout<<dp[n][1]<<endl; 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...