# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
559564 | 2022-05-10T08:03:11 Z | Pherokung | 캥거루 (CEOI16_kangaroo) | C++14 | 1 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; #define N 2005 #define ll long long const int mod = 1e9+7; int n,cs,cf,del; ll dp[N][N],ans; int main(){ scanf("%d%d%d",&n,&cs,&cf); dp[1][1] = 1; for(int idx=2;idx<=n;idx++){ for(int comp=1;comp<=idx;comp++){ if(idx == cs || idx == cf){ dp[idx][comp] += dp[idx-1][comp] + dp[idx-1][comp-1]; del++; } else{ dp[idx][comp] += dp[idx-1][comp-1] * (comp - del); dp[idx][comp] += dp[idx-1][comp+1] * (comp); } // printf("?? %d %d : %lld\n",idx,comp,dp[idx][comp]); dp[idx][comp] %= mod; } } printf("%lld",dp[n][1]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |