J题用double做只对一半改为longlongint就全对
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
 double x,a,y,b;
 while(cin>>x>>a>>y>>b)
 {
  double xa=floor(x/a);
  double yb=floor(y/b);
  if(xa>yb){
   cout<<">\n";
  }
  else if(xa<yb){
   cout<<"<\n";
  }
  else 
  {
   double aa=fmod(x,a)*b,bb=fmod(y,b)*a;
   if(aa>bb) cout<<">\n";
   else if(aa==bb) cout<<"=\n";
   else cout<<"<\n";
  }
   
 } 
 return 0;
}
double都改为long long int就都对了,为什么?
 
字节跳动公司福利 1315人发布
查看5道真题和解析
