Pearlfromsu

inverse el in field

Dec 12th, 2024
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <set>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int x, n;
  9.   cin >> x >> n;
  10.   set<int> st;
  11.   int cur = x;
  12.   st.insert(x);
  13.   for(int i = 0; i < 100000; i++) {
  14.       cur = ((x * cur)%n);
  15.       st.insert(cur);
  16.   }
  17.   cout << st.size();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment