제출 #543122

#제출 시각아이디문제언어결과실행 시간메모리
543122iulia13캥거루 (CEOI16_kangaroo)C++14
0 / 100
71 ms46448 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2005; #define ll long long const ll mod = 1e9 + 7; void sum(ll &a, ll b) { a += b; if (a >= mod) a -= mod; } ll dp[N][N]; int main() { freopen ("kangaroo.in", "r", stdin); freopen ("kangaroo.out", "w", stdout); ll n, cs, cf; cin >> n >> cs >> cf; dp[1][1] = 1; for (ll i = 1; i <= n; i++) for (ll j = 1; j <= i; j++) { if (i == cs || i == cf) { sum(dp[i][j], dp[i - 1][j - 1]); sum(dp[i][j], dp[i - 1][j]); continue; } sum(dp[i][j], dp[i - 1][j + 1] * j % mod); sum(dp[i][j], (dp[i - 1][j - 1] * ((j - 2ll) + 1ll * (i < cs) + 1ll * (i < cf))) % mod); } cout << dp[n][1]; return 0; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:16:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen ("kangaroo.in", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:17:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen ("kangaroo.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...