Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <cstdio>
- #include <iostream>
- using namespace std;
- unsigned int cur = 0;
- unsigned int nextRand24(int a, int b) {
- cur = cur * a + b;
- return cur >> 8;
- }
- unsigned int nextRand32(int x, int y) {
- unsigned int a = nextRand24(x, y);
- unsigned int b = nextRand24(x, y);
- return ((a << 8)^b);
- }
- int main(){
- long long nod, n, a, b, find = 0;
- cin>>n>>a>>b;
- unsigned int x[n];
- for (int i = 0; i < n; i++)
- x[i] = nextRand32(a, b);
- for (int i = 0; i < n; i++)
- find += x[i];
- nod = __gcd(find, n);//ÍÎÄ
- find = find / nod;
- n = n / nod;
- cout<<find<<"/"<<n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement