提交时间:2022-06-05 12:41:52
运行 ID: 41027
#include<bits/stdc++.h> using namespace std; double w,h,W,H,ans; int a1,a2; int fun(int a,double x,double y){ if(a==-1||x<y) return -1; int ans=0; while(x>y) ans++,x/=2; return ans+a; } int main(){ cin>>w>>h>>W>>H; a1=fun(a1,w,W); a1=fun(a1,h,H); a2=fun(a2,w,H); a2=fun(a2,h,W); if(a1==-1||a2==-1){ if(a1==-1) ans=a2; if(a2==-1) ans=a1; }else ans=min(a1,a2); cout<<ans<<endl;; return 0; }