#include #include #include #include #include #include #include int main(){ int n; scanf("%d",&n); // your code goes here int num[n-1][n-1]; int sort(int m,int p,int t); for (int i=0;it/2&&p>t/2){ return -1; } while(m!=t&&p!=t){ if (p+p<=t){ p+=p; } else { p-=p; } step++; m+=m; } if (p==t){ return step+1; } else{ while(p!=t){ if (m+p<=t){ m+=p; } else { m-=p; } step++; p+=m; } return step+1; } }