|
|
вернуться в форумwhat is wrong with my code ??? Послано Adkham 8 фев 2018 02:23 #include<iostream> #include<cmath> using namespace std; int func(int k, int n, int m) { if(n == 0) return 1; else return func(k, n-1, m)*k%m; } int main() { int n, m, y, x, i = 0; int b; bool flag = true; cin >> n >> m >> y; if((n >0 && n < 999) && (m > 1 && m < 999) && (0 < y && < 999)) { while(i < m) { x = func(n, i, m); if(x == y) { cout << i << ' '; flag = false; } i++; } if(flag) cout << "-1"; } else cout << "-1"; return 0; } Edited by author 08.02.2018 02:25 Edited by author 08.02.2018 02:27 |
|
|