You are viewing a single comment's thread. Return to all comments →
The simplest solution, but sadly it didn't like my time
#include <iostream> #include <set> // ****** using namespace std; int main() { int n, s, p, q; cin >> n >> s >> p >> q; const unsigned int range = 1U << 31; int num = s; set<int> a; a.insert(num); for(int i = 1; i < n; i++){ num = (num*p+q) % range; a.insert(num); } cout << a.size(); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Bit Array
You are viewing a single comment's thread. Return to all comments →
The simplest solution, but sadly it didn't like my time