제출 #710467

#제출 시각아이디문제언어결과실행 시간메모리
710467lukameladze캥거루 (CEOI16_kangaroo)C++14
100 / 100
43 ms39612 KiB
# include <bits/stdc++.h> using namespace std; #define f first #define s second #define int long long #define pii pair <int, int> #define pb push_back const int N = 3005, mod = 1e9 + 7; int t,n,a[N],dp[N][N],cs,cf; main() { std::ios_base::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]; dp[i][j] %= mod; } else { dp[i][j] += dp[i - 1][j + 1] * j % mod; dp[i][j] += dp[i - 1][j - 1] * (j - (i > cs) - (i > cf)) % mod; dp[i][j] %= mod; } } } cout<<dp[n][1]<<"\n"; }

컴파일 시 표준 에러 (stderr) 메시지

kangaroo.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...