标签:one sed nbsp names problem pac opened als ems
https://www.codechef.com/ICL2019/problems/ICL1906
1 #include <bits/stdc++.h> 2 using namespace std; 3 int t,x,y; 4 int main(){ 5 ios::sync_with_stdio(false); 6 cin>>t; 7 while (t--){ 8 cin>>x>>y; 9 if(x==0&&y==0){ 10 cout<<0<<endl; 11 continue; 12 } 13 if(x==0||y==0){ 14 cout<<-1<<endl; 15 continue; 16 } 17 if(x>y)swap(x,y); 18 int ans = 0; 19 while (x!=y){ 20 if(x*2<=y){ 21 x*=2; 22 ans++; 23 }else{ 24 y--,x--; 25 ans++; 26 } 27 } 28 ans+=x; 29 cout<<ans<<endl; 30 } 31 }
标签:one sed nbsp names problem pac opened als ems
原文地址:https://www.cnblogs.com/MXang/p/10624773.html