|
|
back to boardWho knows what is WA 6?! my program works correctly I think! Posted by Nęmø..! 20 Jan 2011 20:23 c++: #include<iostream> using namespace std; long long sqr(int x, int y){ long long a=1; for(int i=1;i<=y;i++) a*=x; return a; } int main(){ int n,y,m,a=-1; cin>>n>>m>>y; if(y>=m){ cout<<-1<<endl; return 0; } for(int x=0;x<m;x++) if((sqr(x,n))%m==y){ cout<<x<<" "; a+=2; } cout<<endl; if(a==-1 && y<m) cout<<-1<<endl; return 0; } please help me! Edited by author 20.01.2011 20:31 Edited by author 20.01.2011 20:33 Re: Who knows what is WA 6?! my program works correctly I think! Posted by Ahmad 21 Apr 2011 15:13 You should include math libarary like <math.h> or <cmath> Re: Who knows what is WA 6?! my program works correctly I think! Posted by Nęmø..! 30 Aug 2011 19:48 Of course not! I've coded function sqr! Re: Who knows what is WA 6?! my program works correctly I think! Problem is in "long long int" - not enough for 998^999 Re: Who knows what is WA 6?! my program works correctly I think! Use BigInteger |
|
|