제출 #870073

#제출 시각아이디문제언어결과실행 시간메모리
870073blackslex캥거루 (CEOI16_kangaroo)C++17
100 / 100
16 ms23132 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 2005, M = 1e9 + 7; ll n, cs, cf, ed, dp[N][N]; int main() { scanf("%lld %lld %lld", &n, &cs, &cf); dp[1][1] = 1; ed += (cs == 1 || cf == 1); for (int i = 1; i < n; i++) { if (i + 1 == cs || i + 1 == cf) { for (int j = 1; j <= i; j++) { dp[i + 1][j + 1] += dp[i][j]; dp[i + 1][j + 1] %= M; dp[i + 1][j] += dp[i][j]; dp[i + 1][j] %= M; } ed++; } else { for (int j = 1; j <= i; j++) { dp[i + 1][j + 1] += (j + 1 - ed) * dp[i][j]; dp[i + 1][j + 1] %= M; dp[i + 1][j - 1] += (j - 1) * dp[i][j]; dp[i + 1][j - 1] %= M; } } } printf("%lld", dp[n][1]); }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld %lld %lld", &n, &cs, &cf);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...