ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213917 | #2662. 折跃 | one_zero_four_zero | 0 | 4ms | 1668kb | C++11 | 987b | 2024-11-14 18:54:43 | 2024-11-14 23:00:57 |
answer
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define mod 1000000007LL
using namespace std;
int N, A, B, K;
long long ans = 0;
long long dp[5005][5005];
int cnt[5005];
int main(){
#ifndef ONLINE_JUDGE
freopen("../data.in", "r", stdin);
freopen("../data.out", "w", stdout);
#endif
scanf("%d %d %d %d", &N, &A, &B, &K);
dp[0][A] = 1;
for (int i = 1; i <= N; i ++){
if (i == B) continue;
for (int j = 1; j <= N; j ++){
if (i == j) continue;
if (j == B) continue;
if (abs(i - j) >= abs(i - B)) continue;
cnt[i] ++;
}
}
for (int i = 0; i < N; i ++){
for (int j = 1; j <= N; j ++){
if (j == B) continue;
for (int k = 1; k <= N; k ++){
if (j == k) continue;
if (k == B) continue;
if (abs(j - k) >= abs(j - B)) continue;
dp[i + 1][k] = (dp[i + 1][k] + dp[i][j]) % mod;
}
}
}
for (int i = 1; i <= N; i ++){
ans += dp[N][i];
ans %= mod;
}
printf("%lld\n", ans);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 1668kb
input:
98 18 22 94
output:
192959578
result:
wrong answer 1st lines differ - expected: '27076018', found: '192959578'
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 1648kb
input:
95 94 73 92
output:
586043573
result:
wrong answer 1st lines differ - expected: '748455277', found: '586043573'
Test #3:
score: 0
Time Limit Exceeded
input:
4674 2740 4172 4983
output:
result:
Test #4:
score: 0
Time Limit Exceeded
input:
4981 813 4046 4994
output:
result:
Test #5:
score: 0
Time Limit Exceeded
input:
4595 3757 519 4810
output:
result:
Test #6:
score: 0
Time Limit Exceeded
input:
4902 277 2317 4821
output:
result:
Test #7:
score: 0
Time Limit Exceeded
input:
4516 1607 639 4990
output:
result:
Test #8:
score: 0
Time Limit Exceeded
input:
4823 1127 3840 4648
output:
result:
Test #9:
score: 0
Time Limit Exceeded
input:
4937 3261 2918 4817
output:
result:
Test #10:
score: 0
Time Limit Exceeded
input:
4744 135 2414 4828