제출 #741049

#제출 시각아이디문제언어결과실행 시간메모리
741049Mihailo캥거루 (CEOI16_kangaroo)C++17
0 / 100
0 ms340 KiB
#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; long long N, cs, cf, dp[2500][2500]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>N>>cs>>cf; dp[0][0]=1; for(int i=1; i<=N; i++) { for(int j=1; j<=N; j++) { if(i==cs||i==cf) { dp[i][j]=dp[i-1][j]+dp[i-1][j-1]; } else dp[i][j]=(j-(i>cs)-(i>cf))*dp[i-1][j-1]+(j*(j+1)/2)*dp[i-1][j+1]; } } cout<<dp[N][1]; 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...