제출 #806989

#제출 시각아이디문제언어결과실행 시간메모리
806989nonono캥거루 (CEOI16_kangaroo)C++14
100 / 100
18 ms22996 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int mod = 1e9 + 7; const int mxN = 2005; int n, s, f; int dp[mxN][mxN]; signed main() { #define taskname "" if(fopen(taskname".inp", "r")) { freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } cin.tie(0)->sync_with_stdio(0); cin >> n >> s >> f; dp[1][1] = 1; for(int i = 1; i < n; i ++) { int x = (i + 1 >= s) + (i + 1 >= f); for(int j = 1; j <= i; j ++) { if(i + 1 == s || i + 1 == f) { dp[i + 1][j] += dp[i][j]; dp[i + 1][j + 1] += dp[i][j]; continue ; } (dp[i + 1][j + 1] += dp[i][j] * (j + 1 - x)) %= mod; (dp[i + 1][j - 1] += dp[i][j] * (j - 1)) %= mod; } } cout << dp[n][1] << "\n"; return 0; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:16:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         freopen(taskname".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...