参考博客:http://blog.csdn.net/jenly121/article/details/14521287
其实就是个找规律题,说起这样的题,我的内心几乎是崩溃的,感觉又回到了初高中时代,那些题还没有以前做的顺溜了。
#include<iostream>
using namespace std;
int run(int x);
int main()
{
int n;
cin>>n;
cout<<run(n)<<endl;
//system("pause");
return 0;
}
int run(int x)
{
if(x<=2)
return -1;
else if(x%2==1)
return 2;
else
return x/2%2+3;
}