#include using namespace std; #if __has_include() #include #endif using ll=long long; using ull=unsigned long long; using P=pair; templateusing minque=priority_queue,greater>; templatebool chmax(T &a,const T &b){return (abool chmin(T &a,const T &b){return (a>b?(a=b,true):false);} templateistream &operator>>(istream &is,pair&p){is>>p.first>>p.second;return is;} templateistream &operator>>(istream &is,vector &a){for(auto &i:a)is>>i;return is;} templatevoid operator++(pair&a,int n){a.first++,a.second++;} templatevoid operator--(pair&a,int n){a.first--,a.second--;} templatevoid operator++(vector&a,int n){for(auto &i:a)i++;} templatevoid operator--(vector&a,int n){for(auto &i:a)i--;} #define reps(i,a,n) for(int i=(a);i(0) ll myceil(ll a,ll b){return (a+b-1)/b;} template auto vec(const int (&d)[n],const T &init=T()){ if constexpr (id(d,init)); else return init; } #ifdef LOCAL #include #else #define debug(...) static_cast(0) #define debugg(...) static_cast(0) templateostream &operator<<(ostream &os,const pair&p){os<>testcase; for(int i=0;i struct fraction{ T num,den; void simple(){ T g=gcd(num,den); this->num/=g; this->den/=g; } fraction():num(0),den(1){} fraction(T a):num(a),den(1){} fraction(T a,T b):num(a),den(b){ this->simple(); if(this->den<0)this->num*=-1,this->den*=-1; } static fraction raw(T a,T b){ fraction ret; ret.num=a; ret.den=b; return ret; } friend fraction operator+(const fraction &a){return a;} friend fraction operator-(const fraction &a){return fraction::raw(-a.num,a.den);} friend fraction operator+(const fraction &a,const fraction &b){ return fraction(a.num*b.den+b.num*a.den,a.den*b.den); } friend fraction operator-(const fraction &a,const fraction &b){ return fraction(a.num*b.den-b.num*a.den,a.den*b.den); } friend fraction operator*(const fraction &a,const fraction &b){ fraction c(a.num,b.den),d(b.num,a.den); c.num*=d.num; c.den*=d.den; return c; } friend fraction operator/(const fraction &a,const fraction &b){ fraction c(a.num,b.num),d(b.den,a.den); c.num*=d.num; c.den*=d.den; if(c.den<0){ c.num*=-1; c.den*=-1; } return c; } friend bool operator==(const fraction &a,const fraction &b){ return a.num==b.num&&a.den==b.den; } friend bool operator!=(const fraction &a,const fraction &b){ return !(a==b); } friend bool operator<(const fraction &a,const fraction &b){ return a.num*b.den(const fraction &a,const fraction &b){ return a.num*b.den>b.num*a.den; } friend bool operator<=(const fraction &a,const fraction &b){ return !(a>b); } friend bool operator>=(const fraction &a,const fraction &b){ return !(anum>=0)return fraction::raw(this->den,this->num); else return fraction::raw(-this->den,-this->num); } friend ostream &operator<<(ostream &os,const fraction &a){ os< fractionabs(fractionx){ return x>=0?x:-x; } void SOLVE(){ fractiona,b; auto input=[]()->fraction { string s; cin>>s; s.erase(s.begin()+s.find('.')); return fraction(stoll(s),10000); }; a=input(),b=input(); if(b==0)fin("Yes"); if(b<0){ a=a.inv(); b=-b; } if(a.den!=1)fin("No"); if(b.den==1)fin("Yes"); if(b.den>20)fin("No"); debug(a,b); //assume a is integer,1ll { assert(a<=1e9); ll res=1; while(b--){ res*=a; if(res>1e9)return 1e18; } return res; }; ll root_a=[&](){ ll ok=0,ng=ai+1; while(ng-ok>1){ ll mid=(ok+ng)/2; (powi(mid,bj)<=ai?ok:ng)=mid; } return ok; }(); cout<<(powi(root_a,bj)==a?"Yes":"No")<