Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define pb push_back
- #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
- #define F first
- #define S second
- typedef long long ll;
- typedef vector< int > vi;
- typedef vector< ll > V;
- typedef map<int, int > mp;
- #define debug cout << -1 << endl;
- #define REP(i, a, b) for(int i=a; i<b; i++)
- #define pop pop_back
- const ll MOD = 1000000007;
- const int maxN = 2001;
- int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
- int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
- void solve()
- {
- ll n, m, y;
- cin >> n >> m >> y;
- //vi v;
- int cnt = 0;
- REP(i, 0, m) {
- int mul = 1;
- REP(j, 0, n) {
- mul = ((mul%m) * (i%m))%m;
- }
- if(mul%m==y) {
- cnt++;
- cout << i << " ";
- }
- }
- if(!cnt) cout << -1 << endl;
- cout << endl;
- }
- int main()
- {
- FastIO;
- //freopen("billboard.in","r",stdin);
- //freopen("billboard.out","w",stdout);
- int t;
- t = 1;
- //cin >> t;
- while(t--){
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement