SHARE
TWEET

Untitled

a guest Jan 16th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int findd(int data){
  2.     int l = 1, r = n;
  3.     while (r - l > 1){
  4.         int mid = (l + r) >> 1;
  5.         if (q[mid] > data)
  6.             r = mid;
  7.         else l = mid;
  8.     }
  9.     if (q[l] == data) return l;
  10.     if (q[r] == data) return r;
  11.     return 0;
  12. }
  13.  
  14.  ++n;
  15.         x[1] = a+b; q[1] = a+b;
  16.         x[2] = a-b; q[2] = a-b;
  17.         for (int i = 3; i <= n; ++i){
  18.             x[i] = (a*x[i-2] + b*x[i-1])%m;
  19.             q[i] = x[i];
  20.         }
  21.         for (int i = 1; i <= n; ++i)
  22.             x[i] = findd(x[i]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top