| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1369120 | Newtonabc | 캥거루 (CEOI16_kangaroo) | C++20 | 20 ms | 31852 KiB |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
const int N=2e3+10;
ll dp[N][N];
int main(){
int n,st,ed; cin>>n >>st >>ed;
if(st>ed) swap(st,ed);
dp[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==st || i==ed){
dp[i][j]+=dp[i-1][j];
dp[i][j]+=dp[i-1][j-1];
dp[i][j]%=MOD;
}
else{
dp[i][j]+=dp[i-1][j-1]*(ll)(j-(i>st)-(i>ed));
dp[i][j]+=dp[i-1][j+1]*(ll)(j);
dp[i][j]%=MOD;
}
}
}
cout<<dp[n][1];
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
