|
|
back to boardWA#4 #include<iostream> #include<cmath> using namespace std; int tinh(int x, int n) { int temp = 1; for(int i = 0; i < n; i++) temp *= x; return temp; } void main() { int n, m, y, x; bool flag = true; cin >> n >> m >> y; for(x = 0; x < m; x++) { if(tinh(x, n)%m == y) { cout << x << " "; flag = false; } } if(flag) cout << -1; } Re: WA#4 tinh(x, n) may produce a very big number that leading overflow |
|
|