QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#73212#2934. How Many Unicycles in a Broken Wheelqdd#AC ✓34ms3612kbC++14734b2023-01-23 05:38:202023-01-23 05:38:21

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-23 05:38:21]
  • 评测
  • 测评结果:AC
  • 用时:34ms
  • 内存:3612kb
  • [2023-01-23 05:38:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

const int mod = 100007;
const int N = 4007;
int dp[N];
int special[N];
int partial[N];

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	dp[0] = 1, dp[1] = 2, dp[2] = 5;
	special[0] = 1, special[1] = 3, special[2] = 8;
	partial[0] = 2, partial[1] = 5, partial[2] = 13;
	for(int i=3; i<N; i++){
		dp[i] = (2*dp[i-1] + special[i-2]) % mod;
		special[i] = (2*special[i-1] + partial[i-2]) % mod;
		partial[i] = (special[i] + partial[i-1]) % mod;
	}
	int ans = 0;
	int n;
	cin >> n;
	for(int i=n-3; i>=0; i--){
		for(int j=0; j<=i; j++){
			ans += (1ll * dp[j] * dp[i-j]) % mod;
			ans %= mod;
		}
	}
	cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3412kb

input:

5

output:

19

result:

ok single line: '19'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1234

output:

50380

result:

ok single line: '50380'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

3

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 34ms
memory: 3468kb

input:

4000

output:

14774

result:

ok single line: '14774'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3384kb

input:

10

output:

5911

result:

ok single line: '5911'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

6

output:

65

result:

ok single line: '65'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

7

output:

210

result:

ok single line: '210'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

8

output:

654

result:

ok single line: '654'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

9

output:

1985

result:

ok single line: '1985'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

779

output:

59262

result:

ok single line: '59262'

Test #11:

score: 0
Accepted
time: 10ms
memory: 3416kb

input:

2320

output:

14502

result:

ok single line: '14502'

Test #12:

score: 0
Accepted
time: 3ms
memory: 3332kb

input:

768

output:

57480

result:

ok single line: '57480'

Test #13:

score: 0
Accepted
time: 19ms
memory: 3380kb

input:

2471

output:

10444

result:

ok single line: '10444'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3384kb

input:

796

output:

24011

result:

ok single line: '24011'

Test #15:

score: 0
Accepted
time: 29ms
memory: 3360kb

input:

3931

output:

57605

result:

ok single line: '57605'

Test #16:

score: 0
Accepted
time: 21ms
memory: 3416kb

input:

2508

output:

32594

result:

ok single line: '32594'

Test #17:

score: 0
Accepted
time: 17ms
memory: 3468kb

input:

3093

output:

48868

result:

ok single line: '48868'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

138

output:

64281

result:

ok single line: '64281'

Test #19:

score: 0
Accepted
time: 5ms
memory: 3584kb

input:

1367

output:

23969

result:

ok single line: '23969'

Test #20:

score: 0
Accepted
time: 13ms
memory: 3612kb

input:

2335

output:

82476

result:

ok single line: '82476'