QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#629153#2934. How Many Unicycles in a Broken WheelTenshi#AC ✓32ms3756kbC++23954b2024-10-11 06:48:222024-10-11 06:48:23

Judging History

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

  • [2024-10-11 06:48:23]
  • 评测
  • 测评结果:AC
  • 用时:32ms
  • 内存:3756kb
  • [2024-10-11 06:48:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back

const int mod = 100007;
const int N = 4007;

vector<int> f(N), fir(N), sec(N);

inline int add(int x, int y) {
    return (x + y) % mod;
}

signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);

    f[0] = 1, f[1] = 2, f[2] = 5;
    fir[0] = 1, fir[1] = 3, fir[2] = 8;
    sec[0] = 2, sec[1] = 5, sec[2] = 13;

    rep(i, 3, N-1) {
        f[i] = add(2 * f[i-1], fir[i-2]);
        fir[i] = add(2 * fir[i-1], sec[i-2]);
        sec[i] = add(fir[i], sec[i-1]);
    }

    int ans = 0, n;
    cin >> n;

    dwn(i, n-3, 0) {
        rep(j, 0, i) {
            ans = add(ans, 1LL * f[j] * f[i-j] % mod);
        }
    }

    cout << ans;
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3684kb

input:

5

output:

19

result:

ok single line: '19'

Test #2:

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

input:

1234

output:

50380

result:

ok single line: '50380'

Test #3:

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

input:

3

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 32ms
memory: 3756kb

input:

4000

output:

14774

result:

ok single line: '14774'

Test #5:

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

input:

10

output:

5911

result:

ok single line: '5911'

Test #6:

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

input:

6

output:

65

result:

ok single line: '65'

Test #7:

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

input:

7

output:

210

result:

ok single line: '210'

Test #8:

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

input:

8

output:

654

result:

ok single line: '654'

Test #9:

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

input:

9

output:

1985

result:

ok single line: '1985'

Test #10:

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

input:

779

output:

59262

result:

ok single line: '59262'

Test #11:

score: 0
Accepted
time: 11ms
memory: 3756kb

input:

2320

output:

14502

result:

ok single line: '14502'

Test #12:

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

input:

768

output:

57480

result:

ok single line: '57480'

Test #13:

score: 0
Accepted
time: 9ms
memory: 3628kb

input:

2471

output:

10444

result:

ok single line: '10444'

Test #14:

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

input:

796

output:

24011

result:

ok single line: '24011'

Test #15:

score: 0
Accepted
time: 31ms
memory: 3692kb

input:

3931

output:

57605

result:

ok single line: '57605'

Test #16:

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

input:

2508

output:

32594

result:

ok single line: '32594'

Test #17:

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

input:

3093

output:

48868

result:

ok single line: '48868'

Test #18:

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

input:

138

output:

64281

result:

ok single line: '64281'

Test #19:

score: 0
Accepted
time: 4ms
memory: 3680kb

input:

1367

output:

23969

result:

ok single line: '23969'

Test #20:

score: 0
Accepted
time: 11ms
memory: 3748kb

input:

2335

output:

82476

result:

ok single line: '82476'