QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#76635#2936. Simple Collatz SequencexiejWA 2ms3348kbC++17341b2023-02-11 04:47:162023-02-11 04:47:19

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-11 04:47:19]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3348kb
  • [2023-02-11 04:47:16]
  • Submitted

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'