QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#641939 | #2934. How Many Unicycles in a Broken Wheel | faithnhope | WA | 1ms | 4012kb | C++14 | 576b | 2024-10-15 03:45:48 | 2024-10-15 03:45:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 100007;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int m; cin>>m;
long long dp2[40002] = {};
long long dp[40002] = {};
dp[2] = 1;
dp[1] = 0;
dp[3] = 5;
dp2[3] = 8;
dp2[0] = 1;
dp2[1] = 1;
dp2[2] = 3;
for (int i = 4; i <= m; i++) {
dp2[i] = (3*dp2[i-1] - dp2[i-2] ) % MOD;
dp[i] = (3*dp[i-1] - dp[i-2] + dp2[i-1]-dp2[i-2]) % MOD;
//cout<<i<<' '<<dp[i]<<' '<<dp2[i-1]<<' '<<dp3[i-1]<<endl;
}
cout<<dp[m-1];
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3956kb
input:
5
output:
19
result:
ok single line: '19'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4012kb
input:
1234
output:
50380
result:
ok single line: '50380'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
3
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
4000
output:
14774
result:
ok single line: '14774'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
10
output:
5911
result:
ok single line: '5911'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
6
output:
65
result:
ok single line: '65'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
7
output:
210
result:
ok single line: '210'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
8
output:
654
result:
ok single line: '654'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
9
output:
1985
result:
ok single line: '1985'
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3868kb
input:
779
output:
-40745
result:
wrong answer 1st lines differ - expected: '59262', found: '-40745'