Gym - 102163M
https://vjudge.net/problem/2356949/origin
取对数,然后特判特殊情况,就是0的那些情况
#include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #include<set> #include<map> #include<stack> #include<cstring> #define inf 2147483647 #define ls rt<<1 #define rs rt<<1|1 #define lson ls,nl,mid,l,r #define rson rs,mid+1,nr,l,r #define N 100010 #define For(i,a,b) for(int i=a;i<=b;i++) #define p(a) putchar(a) #define g() getchar() using namespace std; int T; double a,b,c,d; double eps=0.0000001; void in(int &x){ int y=1; char c=g();x=0; while(c<'0'||c>'9'){ if(c=='-')y=-1; c=g(); } while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=g(); } x*=y; } void o(int x){ if(x<0){ p('-'); x=-x; } if(x>9)o(x/10); p(x%10+'0'); } int main(){ in(T); while(T--){ cin>>a>>b>>c>>d; if((b==0&&d==0)||(a==0&&c==0)){ cout<<"Lazy"<<endl; continue; } if(a==0&&c!=0){ cout<<"Congrats"<<endl; continue; } if(c==0&&a!=0){ cout<<"HaHa"<<endl; continue; } if(fabs(b*log(a)-d*log(c))<eps) cout<<"Lazy"<<endl; else if(b*log(a)-d*log(c)<0) cout<<"Congrats"<<endl; else cout<<"HaHa"<<endl; } return 0; }