Skip to content

Commit

Permalink
Merge pull request #1071 from suisen-cp/patch_kth_term_of_linear_recu…
Browse files Browse the repository at this point in the history
…rrent_sequence

Fixed issue with the generator `near_65536.cpp` in Kth term of Linearly Recurrent Sequence
  • Loading branch information
maspypy authored Dec 18, 2023
2 parents f54fda2 + 69ec8f3 commit be5461d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion math/kth_term_of_linearly_recurrent_sequence/gen/near_65536.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);

long long d = 65535 + gen.uniform<int>(0, 2);
// https://github.com/yosupo06/library-checker-problems/pull/1069#discussion_r1429047154

// Consume the same number of random numbers as in the original case
gen.uniform<int>(0, 2);

// Correspondence between seeds and d in the original test cases:
// seed d
// ==============
// 0 65535
// 1 65536
// 2 65537
// --------------
int a[3]{ 0, 1, 2 };

long long d = 65535 + a[seed % 3];
long long k = gen.uniform<long long>(0, K_MAX);

printf("%lld %lld\n", d, k);
Expand Down

0 comments on commit be5461d

Please sign in to comment.