QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#461086 | #8487. Scooter numbers | Lynkcat# | AC ✓ | 6ms | 3736kb | C++14 | 1.1kb | 2024-07-02 15:56:35 | 2024-07-02 15:56:35 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 1000000007
#define sz(x) ((int)((x).size()))
#define int ll
// #define N
using namespace std;
const int N=1005;
int dp[N][2],tmp[N][2];
int n;
void BellaKira()
{
cin>>n;
dp[0][0]=1;
for (int i=1;i<=n;i++)
{
memset(tmp,0,sizeof(tmp));
for (int k=0;k<2;k++)
{
for (int j=i;j<=n;j++)
tmp[j][k]=(tmp[j-i][k]+dp[j-i][k])%mod;
}
for (int k=0;k<2;k++)
for (int j=0;j<=n;j++)
{
int coef=1;
if (k==0) coef=i;
tmp[j][1]=(tmp[j][1]+dp[j][k]*coef%mod)%mod;
}
memcpy(dp,tmp,sizeof(tmp));
}
cout<<(dp[n][1]+dp[n][0]*(n+1))%mod<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
1
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
3
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
5
output:
14
result:
ok 1 number(s): "14"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
7
output:
32
result:
ok 1 number(s): "32"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
10
output:
93
result:
ok 1 number(s): "93"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
15
output:
426
result:
ok 1 number(s): "426"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
431
output:
939569366
result:
ok 1 number(s): "939569366"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
339
output:
779167693
result:
ok 1 number(s): "779167693"
Test #10:
score: 0
Accepted
time: 3ms
memory: 3732kb
input:
619
output:
95446348
result:
ok 1 number(s): "95446348"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
527
output:
577792800
result:
ok 1 number(s): "577792800"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
131
output:
124115481
result:
ok 1 number(s): "124115481"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
39
output:
91904
result:
ok 1 number(s): "91904"
Test #14:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
319
output:
584973336
result:
ok 1 number(s): "584973336"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
227
output:
115048980
result:
ok 1 number(s): "115048980"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
135
output:
277566229
result:
ok 1 number(s): "277566229"
Test #17:
score: 0
Accepted
time: 3ms
memory: 3636kb
input:
719
output:
145078347
result:
ok 1 number(s): "145078347"
Test #18:
score: 0
Accepted
time: 5ms
memory: 3540kb
input:
898
output:
683435513
result:
ok 1 number(s): "683435513"
Test #19:
score: 0
Accepted
time: 4ms
memory: 3668kb
input:
806
output:
146315038
result:
ok 1 number(s): "146315038"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
410
output:
459095697
result:
ok 1 number(s): "459095697"
Test #21:
score: 0
Accepted
time: 6ms
memory: 3644kb
input:
994
output:
630763622
result:
ok 1 number(s): "630763622"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
598
output:
336568276
result:
ok 1 number(s): "336568276"
Test #23:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
506
output:
472335883
result:
ok 1 number(s): "472335883"
Test #24:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
414
output:
34633570
result:
ok 1 number(s): "34633570"
Test #25:
score: 0
Accepted
time: 3ms
memory: 3576kb
input:
694
output:
33145311
result:
ok 1 number(s): "33145311"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
602
output:
36309295
result:
ok 1 number(s): "36309295"
Test #27:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
206
output:
965741458
result:
ok 1 number(s): "965741458"
Test #28:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
320
output:
644124816
result:
ok 1 number(s): "644124816"
Test #29:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
229
output:
347321847
result:
ok 1 number(s): "347321847"
Test #30:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
509
output:
595982025
result:
ok 1 number(s): "595982025"
Test #31:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
417
output:
16909210
result:
ok 1 number(s): "16909210"
Test #32:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
21
output:
2048
result:
ok 1 number(s): "2048"
Test #33:
score: 0
Accepted
time: 5ms
memory: 3652kb
input:
909
output:
839672399
result:
ok 1 number(s): "839672399"
Test #34:
score: 0
Accepted
time: 2ms
memory: 3604kb
input:
513
output:
267443664
result:
ok 1 number(s): "267443664"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
117
output:
14068061
result:
ok 1 number(s): "14068061"
Test #36:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
25
output:
5248
result:
ok 1 number(s): "5248"
Test #37:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
609
output:
920742555
result:
ok 1 number(s): "920742555"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
575
output:
758146156
result:
ok 1 number(s): "758146156"
Test #39:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
483
output:
987545474
result:
ok 1 number(s): "987545474"
Test #40:
score: 0
Accepted
time: 4ms
memory: 3672kb
input:
763
output:
122202604
result:
ok 1 number(s): "122202604"
Test #41:
score: 0
Accepted
time: 3ms
memory: 3656kb
input:
671
output:
936583162
result:
ok 1 number(s): "936583162"
Test #42:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
275
output:
325917930
result:
ok 1 number(s): "325917930"
Test #43:
score: 0
Accepted
time: 4ms
memory: 3736kb
input:
859
output:
43843479
result:
ok 1 number(s): "43843479"
Test #44:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
463
output:
161854379
result:
ok 1 number(s): "161854379"
Test #45:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
372
output:
14874157
result:
ok 1 number(s): "14874157"
Test #46:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
280
output:
844882342
result:
ok 1 number(s): "844882342"
Test #47:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
560
output:
580084876
result:
ok 1 number(s): "580084876"
Test #48:
score: 0
Accepted
time: 4ms
memory: 3584kb
input:
830
output:
746490347
result:
ok 1 number(s): "746490347"
Test #49:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
434
output:
233044050
result:
ok 1 number(s): "233044050"
Test #50:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
38
output:
76198
result:
ok 1 number(s): "76198"
Test #51:
score: 0
Accepted
time: 5ms
memory: 3644kb
input:
926
output:
841519650
result:
ok 1 number(s): "841519650"
Test #52:
score: 0
Accepted
time: 2ms
memory: 3588kb
input:
530
output:
267785088
result:
ok 1 number(s): "267785088"
Test #53:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
134
output:
760275453
result:
ok 1 number(s): "760275453"
Test #54:
score: 0
Accepted
time: 3ms
memory: 3728kb
input:
718
output:
481253387
result:
ok 1 number(s): "481253387"
Test #55:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
626
output:
374754869
result:
ok 1 number(s): "374754869"
Test #56:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
534
output:
761711975
result:
ok 1 number(s): "761711975"
Test #57:
score: 0
Accepted
time: 4ms
memory: 3580kb
input:
814
output:
132485354
result:
ok 1 number(s): "132485354"
Test #58:
score: 0
Accepted
time: 4ms
memory: 3600kb
input:
781
output:
266853746
result:
ok 1 number(s): "266853746"
Test #59:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
689
output:
550306339
result:
ok 1 number(s): "550306339"
Test #60:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
293
output:
362728334
result:
ok 1 number(s): "362728334"
Test #61:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
201
output:
459517496
result:
ok 1 number(s): "459517496"
Test #62:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
481
output:
236863306
result:
ok 1 number(s): "236863306"
Test #63:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
389
output:
753961872
result:
ok 1 number(s): "753961872"
Test #64:
score: 0
Accepted
time: 6ms
memory: 3644kb
input:
973
output:
492222103
result:
ok 1 number(s): "492222103"
Test #65:
score: 0
Accepted
time: 5ms
memory: 3648kb
input:
881
output:
974520537
result:
ok 1 number(s): "974520537"
Test #66:
score: 0
Accepted
time: 2ms
memory: 3732kb
input:
485
output:
882444680
result:
ok 1 number(s): "882444680"
Test #67:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
89
output:
177271582
result:
ok 1 number(s): "177271582"
Test #68:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
204
output:
476964940
result:
ok 1 number(s): "476964940"
Test #69:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
112
output:
844981858
result:
ok 1 number(s): "844981858"
Test #70:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
696
output:
139422249
result:
ok 1 number(s): "139422249"
Test #71:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
604
output:
95116575
result:
ok 1 number(s): "95116575"
Test #72:
score: 0
Accepted
time: 5ms
memory: 3660kb
input:
884
output:
358504338
result:
ok 1 number(s): "358504338"
Test #73:
score: 0
Accepted
time: 4ms
memory: 3576kb
input:
792
output:
149579090
result:
ok 1 number(s): "149579090"
Test #74:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
396
output:
735811611
result:
ok 1 number(s): "735811611"
Test #75:
score: 0
Accepted
time: 6ms
memory: 3644kb
input:
980
output:
960754618
result:
ok 1 number(s): "960754618"
Test #76:
score: 0
Accepted
time: 5ms
memory: 3660kb
input:
888
output:
215533287
result:
ok 1 number(s): "215533287"
Test #77:
score: 0
Accepted
time: 2ms
memory: 3604kb
input:
492
output:
678232209
result:
ok 1 number(s): "678232209"
Test #78:
score: 0
Accepted
time: 2ms
memory: 3672kb
input:
458
output:
654077127
result:
ok 1 number(s): "654077127"
Test #79:
score: 0
Accepted
time: 6ms
memory: 3640kb
input:
1000
output:
667750064
result:
ok 1 number(s): "667750064"
Extra Test:
score: 0
Extra Test Passed