QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736588 | #8487. Scooter numbers | Bucketsmith# | AC ✓ | 6ms | 11640kb | C++20 | 860b | 2024-11-12 11:51:04 | 2024-11-12 11:51:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int N = 1e3 + 10, P = 1e9 + 7;
int n, dp[N][N], pp[N][N];
int main() {
cin >> n;
dp[0][0] = 1;
for(int i = 1; i <= n; i ++)
for(int j = i; j <= n; j ++) {
dp[i][j] = dp[i][j - i] + dp[i - 1][j - i];
if(dp[i][j] >= P) dp[i][j] -= P;
}
pp[n + 1][0] = pp[n + 2][0] = 1;
for(int i = n; i >= 1; i --) {
memcpy(pp[i], pp[i + 1], sizeof pp[i]);
for(int j = i; j <= n; j ++) {
pp[i][j] += pp[i][j - i];
if(pp[i][j] >= P) pp[i][j] -= P;
}
}
int ans = 0;
for(int i = 1; i <= n + 1; i ++)
for(int j = 0; j <= n; j ++)
ans = (ans + i * ((i64)dp[i - 1][j] * pp[i + 1][n - j] % P)) % P;
cout << ans << "\n";
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5712kb
input:
1
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5652kb
input:
3
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5704kb
input:
2
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5780kb
input:
5
output:
14
result:
ok 1 number(s): "14"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5800kb
input:
7
output:
32
result:
ok 1 number(s): "32"
Test #6:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
10
output:
93
result:
ok 1 number(s): "93"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5820kb
input:
15
output:
426
result:
ok 1 number(s): "426"
Test #8:
score: 0
Accepted
time: 0ms
memory: 7468kb
input:
431
output:
939569366
result:
ok 1 number(s): "939569366"
Test #9:
score: 0
Accepted
time: 0ms
memory: 7092kb
input:
339
output:
779167693
result:
ok 1 number(s): "779167693"
Test #10:
score: 0
Accepted
time: 3ms
memory: 10004kb
input:
619
output:
95446348
result:
ok 1 number(s): "95446348"
Test #11:
score: 0
Accepted
time: 3ms
memory: 11528kb
input:
527
output:
577792800
result:
ok 1 number(s): "577792800"
Test #12:
score: 0
Accepted
time: 1ms
memory: 6196kb
input:
131
output:
124115481
result:
ok 1 number(s): "124115481"
Test #13:
score: 0
Accepted
time: 1ms
memory: 5796kb
input:
39
output:
91904
result:
ok 1 number(s): "91904"
Test #14:
score: 0
Accepted
time: 1ms
memory: 6956kb
input:
319
output:
584973336
result:
ok 1 number(s): "584973336"
Test #15:
score: 0
Accepted
time: 0ms
memory: 8472kb
input:
227
output:
115048980
result:
ok 1 number(s): "115048980"
Test #16:
score: 0
Accepted
time: 1ms
memory: 6296kb
input:
135
output:
277566229
result:
ok 1 number(s): "277566229"
Test #17:
score: 0
Accepted
time: 4ms
memory: 11088kb
input:
719
output:
145078347
result:
ok 1 number(s): "145078347"
Test #18:
score: 0
Accepted
time: 5ms
memory: 11244kb
input:
898
output:
683435513
result:
ok 1 number(s): "683435513"
Test #19:
score: 0
Accepted
time: 2ms
memory: 10760kb
input:
806
output:
146315038
result:
ok 1 number(s): "146315038"
Test #20:
score: 0
Accepted
time: 3ms
memory: 8904kb
input:
410
output:
459095697
result:
ok 1 number(s): "459095697"
Test #21:
score: 0
Accepted
time: 3ms
memory: 11568kb
input:
994
output:
630763622
result:
ok 1 number(s): "630763622"
Test #22:
score: 0
Accepted
time: 0ms
memory: 10052kb
input:
598
output:
336568276
result:
ok 1 number(s): "336568276"
Test #23:
score: 0
Accepted
time: 3ms
memory: 9632kb
input:
506
output:
472335883
result:
ok 1 number(s): "472335883"
Test #24:
score: 0
Accepted
time: 2ms
memory: 11352kb
input:
414
output:
34633570
result:
ok 1 number(s): "34633570"
Test #25:
score: 0
Accepted
time: 4ms
memory: 10368kb
input:
694
output:
33145311
result:
ok 1 number(s): "33145311"
Test #26:
score: 0
Accepted
time: 3ms
memory: 10404kb
input:
602
output:
36309295
result:
ok 1 number(s): "36309295"
Test #27:
score: 0
Accepted
time: 1ms
memory: 8440kb
input:
206
output:
965741458
result:
ok 1 number(s): "965741458"
Test #28:
score: 0
Accepted
time: 2ms
memory: 8888kb
input:
320
output:
644124816
result:
ok 1 number(s): "644124816"
Test #29:
score: 0
Accepted
time: 0ms
memory: 6600kb
input:
229
output:
347321847
result:
ok 1 number(s): "347321847"
Test #30:
score: 0
Accepted
time: 0ms
memory: 9644kb
input:
509
output:
595982025
result:
ok 1 number(s): "595982025"
Test #31:
score: 0
Accepted
time: 2ms
memory: 9276kb
input:
417
output:
16909210
result:
ok 1 number(s): "16909210"
Test #32:
score: 0
Accepted
time: 1ms
memory: 5776kb
input:
21
output:
2048
result:
ok 1 number(s): "2048"
Test #33:
score: 0
Accepted
time: 0ms
memory: 11216kb
input:
909
output:
839672399
result:
ok 1 number(s): "839672399"
Test #34:
score: 0
Accepted
time: 0ms
memory: 9648kb
input:
513
output:
267443664
result:
ok 1 number(s): "267443664"
Test #35:
score: 0
Accepted
time: 1ms
memory: 6156kb
input:
117
output:
14068061
result:
ok 1 number(s): "14068061"
Test #36:
score: 0
Accepted
time: 0ms
memory: 5752kb
input:
25
output:
5248
result:
ok 1 number(s): "5248"
Test #37:
score: 0
Accepted
time: 0ms
memory: 11596kb
input:
609
output:
920742555
result:
ok 1 number(s): "920742555"
Test #38:
score: 0
Accepted
time: 3ms
memory: 9960kb
input:
575
output:
758146156
result:
ok 1 number(s): "758146156"
Test #39:
score: 0
Accepted
time: 0ms
memory: 9600kb
input:
483
output:
987545474
result:
ok 1 number(s): "987545474"
Test #40:
score: 0
Accepted
time: 4ms
memory: 10728kb
input:
763
output:
122202604
result:
ok 1 number(s): "122202604"
Test #41:
score: 0
Accepted
time: 0ms
memory: 10356kb
input:
671
output:
936583162
result:
ok 1 number(s): "936583162"
Test #42:
score: 0
Accepted
time: 1ms
memory: 8780kb
input:
275
output:
325917930
result:
ok 1 number(s): "325917930"
Test #43:
score: 0
Accepted
time: 5ms
memory: 11020kb
input:
859
output:
43843479
result:
ok 1 number(s): "43843479"
Test #44:
score: 0
Accepted
time: 2ms
memory: 9460kb
input:
463
output:
161854379
result:
ok 1 number(s): "161854379"
Test #45:
score: 0
Accepted
time: 2ms
memory: 7168kb
input:
372
output:
14874157
result:
ok 1 number(s): "14874157"
Test #46:
score: 0
Accepted
time: 0ms
memory: 10356kb
input:
280
output:
844882342
result:
ok 1 number(s): "844882342"
Test #47:
score: 0
Accepted
time: 3ms
memory: 9840kb
input:
560
output:
580084876
result:
ok 1 number(s): "580084876"
Test #48:
score: 0
Accepted
time: 2ms
memory: 11640kb
input:
830
output:
746490347
result:
ok 1 number(s): "746490347"
Test #49:
score: 0
Accepted
time: 3ms
memory: 9160kb
input:
434
output:
233044050
result:
ok 1 number(s): "233044050"
Test #50:
score: 0
Accepted
time: 1ms
memory: 5896kb
input:
38
output:
76198
result:
ok 1 number(s): "76198"
Test #51:
score: 0
Accepted
time: 6ms
memory: 11292kb
input:
926
output:
841519650
result:
ok 1 number(s): "841519650"
Test #52:
score: 0
Accepted
time: 0ms
memory: 9660kb
input:
530
output:
267785088
result:
ok 1 number(s): "267785088"
Test #53:
score: 0
Accepted
time: 0ms
memory: 6252kb
input:
134
output:
760275453
result:
ok 1 number(s): "760275453"
Test #54:
score: 0
Accepted
time: 5ms
memory: 10460kb
input:
718
output:
481253387
result:
ok 1 number(s): "481253387"
Test #55:
score: 0
Accepted
time: 0ms
memory: 10136kb
input:
626
output:
374754869
result:
ok 1 number(s): "374754869"
Test #56:
score: 0
Accepted
time: 0ms
memory: 10312kb
input:
534
output:
761711975
result:
ok 1 number(s): "761711975"
Test #57:
score: 0
Accepted
time: 2ms
memory: 11284kb
input:
814
output:
132485354
result:
ok 1 number(s): "132485354"
Test #58:
score: 0
Accepted
time: 5ms
memory: 10652kb
input:
781
output:
266853746
result:
ok 1 number(s): "266853746"
Test #59:
score: 0
Accepted
time: 4ms
memory: 10412kb
input:
689
output:
550306339
result:
ok 1 number(s): "550306339"
Test #60:
score: 0
Accepted
time: 2ms
memory: 10220kb
input:
293
output:
362728334
result:
ok 1 number(s): "362728334"
Test #61:
score: 0
Accepted
time: 0ms
memory: 8360kb
input:
201
output:
459517496
result:
ok 1 number(s): "459517496"
Test #62:
score: 0
Accepted
time: 0ms
memory: 11264kb
input:
481
output:
236863306
result:
ok 1 number(s): "236863306"
Test #63:
score: 0
Accepted
time: 2ms
memory: 7228kb
input:
389
output:
753961872
result:
ok 1 number(s): "753961872"
Test #64:
score: 0
Accepted
time: 6ms
memory: 11464kb
input:
973
output:
492222103
result:
ok 1 number(s): "492222103"
Test #65:
score: 0
Accepted
time: 2ms
memory: 11104kb
input:
881
output:
974520537
result:
ok 1 number(s): "974520537"
Test #66:
score: 0
Accepted
time: 0ms
memory: 9612kb
input:
485
output:
882444680
result:
ok 1 number(s): "882444680"
Test #67:
score: 0
Accepted
time: 1ms
memory: 6108kb
input:
89
output:
177271582
result:
ok 1 number(s): "177271582"
Test #68:
score: 0
Accepted
time: 1ms
memory: 6572kb
input:
204
output:
476964940
result:
ok 1 number(s): "476964940"
Test #69:
score: 0
Accepted
time: 1ms
memory: 6204kb
input:
112
output:
844981858
result:
ok 1 number(s): "844981858"
Test #70:
score: 0
Accepted
time: 4ms
memory: 10380kb
input:
696
output:
139422249
result:
ok 1 number(s): "139422249"
Test #71:
score: 0
Accepted
time: 3ms
memory: 9948kb
input:
604
output:
95116575
result:
ok 1 number(s): "95116575"
Test #72:
score: 0
Accepted
time: 2ms
memory: 11100kb
input:
884
output:
358504338
result:
ok 1 number(s): "358504338"
Test #73:
score: 0
Accepted
time: 0ms
memory: 10772kb
input:
792
output:
149579090
result:
ok 1 number(s): "149579090"
Test #74:
score: 0
Accepted
time: 0ms
memory: 9128kb
input:
396
output:
735811611
result:
ok 1 number(s): "735811611"
Test #75:
score: 0
Accepted
time: 6ms
memory: 11428kb
input:
980
output:
960754618
result:
ok 1 number(s): "960754618"
Test #76:
score: 0
Accepted
time: 5ms
memory: 11120kb
input:
888
output:
215533287
result:
ok 1 number(s): "215533287"
Test #77:
score: 0
Accepted
time: 0ms
memory: 9640kb
input:
492
output:
678232209
result:
ok 1 number(s): "678232209"
Test #78:
score: 0
Accepted
time: 2ms
memory: 10140kb
input:
458
output:
654077127
result:
ok 1 number(s): "654077127"
Test #79:
score: 0
Accepted
time: 6ms
memory: 11568kb
input:
1000
output:
667750064
result:
ok 1 number(s): "667750064"
Extra Test:
score: 0
Extra Test Passed