|
|
back to boardTest #3 Posted by Anton 25 Sep 2011 16:41 What is test number 3 ? #include <iostream> #include <cmath> using namespace std; typedef unsigned short ushort; ushort POWER(ushort x, ushort y) { ushort z=x; for (ushort i=1; i<y; i++) x = x*z; if (y==0) return 1; else return x; } int main() { ushort n,m,y; bool t=false; cin >> n >> m >> y; for (ushort i=0; i<=(m-1); i++) if ((POWER(i,n)%m)==y) { cout << i << " "; t = true; } if (!t) cout << "-1"; return 0; } If I use type on "int", then TEST #4 ... |
|
|