#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
int xiaomei;
vector<int>arr;
for (int i = 0; i < n; i++)
{
cin >> xiaomei;
arr.push_back(xiaomei);
}
xiaomei = arr[0];
sort(arr.begin() + 1, arr.end());
int cishu = 0;
for (int i = 1,j=2; i < n-1; )
{
if (xiaomei >= arr[i])
{
cishu++;
i =(int)pow(2.0,(double)j)-1;
j++;
}
else
break;
}
cout << cishu+1;
}
cout << endl;
return 0;
}
请问一下,这段代码错在哪里呢?
全部评论
(0) 回帖