| ||||||||||
| 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 | |||||||||
wa求助各路大神#include<iostream>
#include<cmath>
using namespace std;
long long x,y,z,m,n,k;
double f,g;
int main()
{
long long a,b,c,d,e;
while(cin>>a>>b>>c>>k && a && b && c && k)
{
x=b-a;
f=k;
f=pow(2,f);
y=f;
if(x<0) x=x+y;
if(x%y==0) {cout<<0<<endl; continue;}
if((x&(-x))<(c&(-c)))
if((x&(-x))<y){cout<<"FOREVER"<<endl; continue;}
z=y%c;
m=x%c;
d=0;
while((d*z+m)%c) d++;
cout<<(d*y+x)/c<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator