QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73211 | #2936. Simple Collatz Sequence | qdd# | AC ✓ | 7ms | 9816kb | C++20 | 846b | 2023-01-23 05:34:39 | 2023-01-23 05:34:40 |
Judging History
answer
// qdd on Jan 22, 2023
#ifdef qdd
#include <ringo>
#else
#include <bits/stdc++.h>
#define dbg(...)
#define dbgr(x, y)
#endif
using namespace std;
using ll = long long;
#define ALL(x) begin(x), end(x)
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
for (T& x : v) is >> x;
return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
bool f = 0;
for (const T& x : v) (f ? os << ' ' : os) << x, f = 1;
return os;
}
const int N = 400001;
const int P = 1000007;
ll o[N], e[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
o[0] = 1, e[1] = 1, e[2] = 1;
for (int i = 3; i < N; i++) {
o[i] = e[i - 1];
e[i] = (e[i - 1] + o[i - 1]) % P;
}
int n;
cin >> n;
cout << (o[n] + e[n]) % P << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 7ms
memory: 9784kb
input:
6
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 2ms
memory: 9808kb
input:
12345
output:
540591
result:
ok single line: '540591'
Test #3:
score: 0
Accepted
time: 2ms
memory: 9624kb
input:
1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 3ms
memory: 9620kb
input:
40000
output:
852282
result:
ok single line: '852282'
Test #5:
score: 0
Accepted
time: 7ms
memory: 9580kb
input:
2148
output:
427120
result:
ok single line: '427120'
Test #6:
score: 0
Accepted
time: 2ms
memory: 9584kb
input:
14386
output:
377717
result:
ok single line: '377717'
Test #7:
score: 0
Accepted
time: 7ms
memory: 9588kb
input:
31251
output:
42371
result:
ok single line: '42371'
Test #8:
score: 0
Accepted
time: 3ms
memory: 9588kb
input:
33516
output:
503005
result:
ok single line: '503005'
Test #9:
score: 0
Accepted
time: 2ms
memory: 9584kb
input:
6167
output:
148870
result:
ok single line: '148870'
Test #10:
score: 0
Accepted
time: 3ms
memory: 9532kb
input:
8508
output:
71598
result:
ok single line: '71598'
Test #11:
score: 0
Accepted
time: 3ms
memory: 9572kb
input:
18757
output:
910805
result:
ok single line: '910805'
Test #12:
score: 0
Accepted
time: 3ms
memory: 9808kb
input:
29843
output:
982119
result:
ok single line: '982119'
Test #13:
score: 0
Accepted
time: 2ms
memory: 9616kb
input:
8618
output:
946465
result:
ok single line: '946465'
Test #14:
score: 0
Accepted
time: 1ms
memory: 9816kb
input:
26480
output:
427468
result:
ok single line: '427468'
Test #15:
score: 0
Accepted
time: 7ms
memory: 9620kb
input:
23988
output:
536392
result:
ok single line: '536392'
Test #16:
score: 0
Accepted
time: 1ms
memory: 9584kb
input:
39830
output:
852687
result:
ok single line: '852687'
Test #17:
score: 0
Accepted
time: 7ms
memory: 9808kb
input:
10055
output:
571911
result:
ok single line: '571911'
Test #18:
score: 0
Accepted
time: 2ms
memory: 9668kb
input:
2227
output:
361051
result:
ok single line: '361051'
Test #19:
score: 0
Accepted
time: 3ms
memory: 9564kb
input:
33772
output:
41792
result:
ok single line: '41792'
Test #20:
score: 0
Accepted
time: 3ms
memory: 9616kb
input:
2094
output:
41578
result:
ok single line: '41578'