![这里写图片描述](https://img-blog.csdn.net/20150907201114115)
vector<int> m_vRankRegion;
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(1);
m_vRankRegion.push_back(5);
m_vRankRegion.push_back(5);
m_vRankRegion.push_back(5);
m_vRankRegion.push_back(5);
int GetIdByRank(int rank)
{
std::vector<int> :: const_iterator pos;
int id = 0;
for(pos = m_vRankRegion.begin(); pos != m_vRankRegion.end(); ++pos)
{
if(*pos > 0 && rank >= *pos)
{
++id;
rank -= *pos;
}
else if(*pos > 0 && rank > 0)
{
++id;
break;
}
else
break;
}
return id;
}