제출 #442635

#제출 시각아이디문제언어결과실행 시간메모리
442635parsabahrami캥거루 (CEOI16_kangaroo)C++17
100 / 100
39 ms15976 KiB
/* I do it for the glory */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define SZ(x) (int) x.size() #define F first #define S second const int N = 2e3 + 10, MOD = 1e9 + 7; int n, s, e, dp[N][N]; int main() { scanf("%d%d%d", &n, &s, &e); dp[1][1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == s || i == e) dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD; else { int x = j; if (i > s) x--; if (i > e) x--; dp[i][j] = (1ll * dp[i - 1][j + 1] * j % MOD + dp[i - 1][j - 1] * 1ll * x % MOD) % MOD; } } } printf("%d\n", dp[n][1]); return 0; }

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

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