| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:SOS:大虾帮忙!!In Reply To:SOS:大虾帮忙!! Posted by:cpp050700448084 at 2005-04-03 15:00:15 > #include <iostream.h>
> #include <math.h>
> void main()
> {
> int a,c,m,j,sum=0;
> cin>>a>>c>>m;
> int *r=new int[m];cin>>r[0];
> for (int i=1;i<m;i++){
> r[i]=(a*r[i-1]+c)%m;
> if(fabs(r[i]-r[i-1])>sum) sum= fabs(r[i]-r[i-1]) ;
> for (j=0;j<i;j++)
> if(r[j]==r[i])
> goto loop;
> }
> loop : cout<<sum<<endl;
> delete []r;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator