Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<time.h>
- using namespace std;
- #define ll long long
- /* ----------------- ~~~~~~~ ----------------- */
- ll l, r, m, res;
- /* ----------------- ~~~~~~~ ----------------- */
- int main(){
- //freopen("INPUT.inp", "r", stdin);
- //freopen("OUTPUT.out", "w", stdout);
- ios_base::sync_with_stdio(0); cin.tie(0);
- /* ----------------- main func ----------------- */
- srand(time(0));
- cin >> l >> r >> m;
- res = m;
- while(clock() <= 0.95*CLOCKS_PER_SEC){
- int x = rand()%(r - l + 1) + l;
- if(x != l)
- res = min(res, x*(rand()%(x - l) + l)%m);
- if(x != r)
- res = min(res, x*(rand()%(r - x) + x + 1)%m);
- }
- cout << res;
- /* ----------------- ~~~~~~~~~ ----------------- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement