#include #define MAX 10000 using namespace std; int Search(int now,int count,const int n,bool stock[]){ int check=1; int one_count=0; for(int i=0;;i++){ if(now<(check<=(now+one_count)){ if(stock[now+one_count]){ p=-1; }else if(n==(now+one_count)){ p=count+1; }else{ stock[now+one_count]=true; p=Search(now+one_count,count+1,n,stock); } }else{ p=-1; } if(now-one_count>=1){ if(stock[now-one_count]){ m=-1; }else{ stock[now-one_count]=true; m=Search(now-one_count,count+1,n,stock); } }else{ m=-1; } if(p==-1 && m==-1){ return -1; }else if(p==-1 || m==-1){ if(p==-1)return m; if(m==-1)return p; } return (p>m ? m : p); } int main(){ int n=0; bool stock[MAX+1]; for(int i=1;i>n; stock[1]=true; int ans=Search(1,1,n,stock); cout<