QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#76635 | #2936. Simple Collatz Sequence | xiej | WA | 2ms | 3348kb | C++17 | 341b | 2023-02-11 04:47:16 | 2023-02-11 04:47:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000007;
int main() {
int m;
cin >> m;
if (m == 1 || m == 2) {
cout << 1 << "\n";
return 0;
}
long long a = 1;
long long b = 1;
m -= 2;
while (m > 0) {
b += a;
b %= MOD;
a = b - a;
a %= MOD;
m--;
}
cout << b << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3216kb
input:
6
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3244kb
input:
12345
output:
540591
result:
ok single line: '540591'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3348kb
input:
1
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3328kb
input:
40000
output:
-147725
result:
wrong answer 1st lines differ - expected: '852282', found: '-147725'