QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#421860 | #6460. Mountain Scenes | nitrousoxide# | AC ✓ | 6ms | 12168kb | C++14 | 991b | 2024-05-26 08:42:21 | 2024-05-26 08:42:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int modi = 1'000'000'007;
int dp[112][10240], s[112][10240];
inline void inc(int & x, int v) {
x += v;
if (x >= modi) {
x -= modi;
}
}
int main() {
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i <= n; i++) {
dp[1][i] = min(h+1, i+1);
if (i != 0) s[1][i] = s[1][i-1];
inc(s[1][i], dp[1][i]);
}
for (int i = 2; i <= w; i++) {
dp[i][0] = 1;
for (int j = 1; j <= n; j++) {
if (j <= h) {
dp[i][j] = s[i-1][j];
} else {
dp[i][j] = s[i-1][j] - s[i-1][j-h-1];
if (dp[i][j] < 0) dp[i][j] += modi;
}
}
s[i][0] = dp[i][0];
for (int j = 1; j <= n; j++) {
s[i][j] = s[i][j-1];
inc(s[i][j], dp[i][j]);
}
}
cout << (dp[w][n] - (min(n/w, h) + 1) % modi + modi) % modi << endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5704kb
input:
25 5 5
output:
7770
result:
ok single line: '7770'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5696kb
input:
15 5 5
output:
6050
result:
ok single line: '6050'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
10 10 1
output:
1022
result:
ok single line: '1022'
Test #4:
score: 0
Accepted
time: 1ms
memory: 5616kb
input:
4 2 2
output:
6
result:
ok single line: '6'
Test #5:
score: 0
Accepted
time: 3ms
memory: 12124kb
input:
10000 100 100
output:
502424636
result:
ok single line: '502424636'
Test #6:
score: 0
Accepted
time: 1ms
memory: 5588kb
input:
10000 1 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 5ms
memory: 12112kb
input:
10000 100 1
output:
976371283
result:
ok single line: '976371283'
Test #8:
score: 0
Accepted
time: 1ms
memory: 5648kb
input:
10000 1 100
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 1ms
memory: 9996kb
input:
1 100 100
output:
100
result:
ok single line: '100'
Test #10:
score: 0
Accepted
time: 1ms
memory: 9876kb
input:
0 100 100
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 9884kb
input:
1420 36 79
output:
649438197
result:
ok single line: '649438197'
Test #12:
score: 0
Accepted
time: 1ms
memory: 5812kb
input:
1451 17 76
output:
264834562
result:
ok single line: '264834562'
Test #13:
score: 0
Accepted
time: 1ms
memory: 9900kb
input:
1664 33 80
output:
903182149
result:
ok single line: '903182149'
Test #14:
score: 0
Accepted
time: 4ms
memory: 11008kb
input:
5915 93 24
output:
635984237
result:
ok single line: '635984237'
Test #15:
score: 0
Accepted
time: 6ms
memory: 11424kb
input:
8577 86 92
output:
369573031
result:
ok single line: '369573031'
Test #16:
score: 0
Accepted
time: 0ms
memory: 10132kb
input:
1595 66 96
output:
42134373
result:
ok single line: '42134373'
Test #17:
score: 0
Accepted
time: 0ms
memory: 10624kb
input:
3430 99 4
output:
629396289
result:
ok single line: '629396289'
Test #18:
score: 0
Accepted
time: 5ms
memory: 12168kb
input:
6109 92 71
output:
177326550
result:
ok single line: '177326550'
Test #19:
score: 0
Accepted
time: 6ms
memory: 11672kb
input:
8560 98 57
output:
196315713
result:
ok single line: '196315713'
Test #20:
score: 0
Accepted
time: 6ms
memory: 11712kb
input:
9723 85 85
output:
297305331
result:
ok single line: '297305331'
Test #21:
score: 0
Accepted
time: 0ms
memory: 5872kb
input:
6665 7 41
output:
539331596
result:
ok single line: '539331596'
Test #22:
score: 0
Accepted
time: 3ms
memory: 12028kb
input:
6511 58 28
output:
701126549
result:
ok single line: '701126549'
Test #23:
score: 0
Accepted
time: 0ms
memory: 10400kb
input:
2835 94 51
output:
838020060
result:
ok single line: '838020060'
Test #24:
score: 0
Accepted
time: 1ms
memory: 9868kb
input:
65 33 94
output:
109739472
result:
ok single line: '109739472'
Test #25:
score: 0
Accepted
time: 4ms
memory: 10984kb
input:
9505 72 44
output:
676217746
result:
ok single line: '676217746'
Test #26:
score: 0
Accepted
time: 2ms
memory: 9760kb
input:
6912 45 31
output:
588848907
result:
ok single line: '588848907'
Test #27:
score: 0
Accepted
time: 2ms
memory: 10000kb
input:
1574 65 80
output:
189483116
result:
ok single line: '189483116'
Test #28:
score: 0
Accepted
time: 1ms
memory: 5600kb
input:
418 14 61
output:
519877002
result:
ok single line: '519877002'
Test #29:
score: 0
Accepted
time: 0ms
memory: 11136kb
input:
6637 88 58
output:
956699055
result:
ok single line: '956699055'
Test #30:
score: 0
Accepted
time: 1ms
memory: 6112kb
input:
4339 19 14
output:
359541896
result:
ok single line: '359541896'