#include<stdio.h>
int chang(int x,int s){
        if(x==1)
        return s;
        else if(x==2)
        return s+1;
        else if(x%2!=0){
        s+=(x-1)/2;
                return chang((x+1)/2,s);
        }
        else{
        s+=x/2;
                return chang(x/2,s);
        }

}
int lun(int x){
        if(x==1)
        return 0;
        else if(x==2)
        return 1;
        else if(x%2!=0){
                return 1+lun((x+1)/2);
        }
        else
                return 1+lun(x/2);
}
int main()
{
    int K;
    scanf("%d", &K);
    while(K--)
    {
        int n;
        scanf("%d", &n);
        printf("%d %d\n", lun(n),chang(n,0));
    }
    return 0;
    }

 

相关文章:

  • 2021-09-01
  • 2021-11-28
  • 2021-04-29
  • 2021-10-16
  • 2021-10-17
  • 2021-09-30
猜你喜欢
  • 2021-09-11
  • 2021-10-25
  • 2021-12-14
  • 2022-01-10
  • 2022-03-01
  • 2021-10-03
  • 2022-12-23
相关资源
相似解决方案