QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#227816 | #2934. How Many Unicycles in a Broken Wheel | Thallium54# | AC ✓ | 32ms | 3824kb | C++20 | 916b | 2023-10-28 00:16:45 | 2023-10-28 00:16:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
const int N = 2e5 + 100;
const int inf = 1e9;
const ll mod = 998244353;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
const int mod = 100007;
vector dp(n + 1, vector(2, 0));
dp[0][1] = 1;
dp[1][0] = 1;
dp[1][1] = 2;
for (int i = 2; i <= n; i++) {
dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % mod;
dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][1]) % mod;
}
n--;
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
ans = (ans + (ll)dp[i][1] * dp[n - j - 1][1] % mod) % mod;
}
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
5
output:
19
result:
ok single line: '19'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3684kb
input:
1234
output:
50380
result:
ok single line: '50380'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 32ms
memory: 3808kb
input:
4000
output:
14774
result:
ok single line: '14774'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
10
output:
5911
result:
ok single line: '5911'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
6
output:
65
result:
ok single line: '65'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
7
output:
210
result:
ok single line: '210'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
8
output:
654
result:
ok single line: '654'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
9
output:
1985
result:
ok single line: '1985'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3820kb
input:
779
output:
59262
result:
ok single line: '59262'
Test #11:
score: 0
Accepted
time: 11ms
memory: 3736kb
input:
2320
output:
14502
result:
ok single line: '14502'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
768
output:
57480
result:
ok single line: '57480'
Test #13:
score: 0
Accepted
time: 12ms
memory: 3660kb
input:
2471
output:
10444
result:
ok single line: '10444'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3816kb
input:
796
output:
24011
result:
ok single line: '24011'
Test #15:
score: 0
Accepted
time: 31ms
memory: 3808kb
input:
3931
output:
57605
result:
ok single line: '57605'
Test #16:
score: 0
Accepted
time: 13ms
memory: 3732kb
input:
2508
output:
32594
result:
ok single line: '32594'
Test #17:
score: 0
Accepted
time: 19ms
memory: 3652kb
input:
3093
output:
48868
result:
ok single line: '48868'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
138
output:
64281
result:
ok single line: '64281'
Test #19:
score: 0
Accepted
time: 4ms
memory: 3820kb
input:
1367
output:
23969
result:
ok single line: '23969'
Test #20:
score: 0
Accepted
time: 11ms
memory: 3744kb
input:
2335
output:
82476
result:
ok single line: '82476'