(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #44782

#제출 시각아이디문제언어결과실행 시간메모리
44782bogdan10bos캥거루 (CEOI16_kangaroo)C++14
100 / 100
24 ms14464 KiB
#include <bits/stdc++.h> using namespace std; //#define FILE_IO const int mod = 1e9 + 7; int dp[2005][2005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif int N, st, fn; scanf("%d%d%d", &N, &st, &fn); dp[1][1] = 1; int ends = 2; if(st == 1 || fn == 1) ends--; for(int i = 2; i <= N; i++) { if(i == st || i == fn) { for(int j = 1; j <= i; j++) dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % mod; ends--; continue; } for(int j = 1; j <= i; j++) { dp[i][j] = 0; if(j - 2 + ends >= 0) dp[i][j] = (1LL * dp[i - 1][j - 1] * (j - 2 + ends)) % mod; dp[i][j] += (1LL * dp[i - 1][j + 1] * j) % mod; dp[i][j] %= mod; } } printf("%d\n", dp[N][1]); return 0; }

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

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