帮忙看一下哪儿错了
我研究一天了
#include <iostream>
#include <cstdio>
using namespace std;
int a[100001];
int qsort(int l,int r)
{
	int i=l,j=r,mid=a[(l+r)/2];
	while (i<j)
	{
		while (a[i]<mid) i++;
		while (a[j]>mid) j--;
		if (i<=j)
		{
			int x=a[i];
			a[i]=a[j];
			a[j]=x;
			i++;
			j--;
		}
	}
	if (i<r) qsort(i,r);
	if (j>l) qsort(l,j);
	return 0;
}
int main()
{
	int n,m;
	while (scanf(\"%d %d\",&n,&m)!=EOF)
	{
		for (int i=1;i<=n;i++)
			scanf(\"%d\",&a[i]);
		qsort(1,n);
		for (int k=1;k<=m;k++)
		{
			int y;
			scanf(\"%d\",&y);
			int j=n/2;
			int b=1;
			while (a[j]<y && a[b]<y)
			{
				j++;
				b++;
			}
			if (a[j]==y) printf(\"%d\\n\",j-1);
			if (a[b]==y) printf(\"%d\\n\",b-1);
		}
	}
	return 0;
}
我只会c,不好意思
这样也超,我发觉我做二分的题目都不行啊
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<long long>nubs;
void dfs(int d,long long num)
{
	if (num!=0 && num%48==0)
		nubs.push_back(num);
	if (d>16) return;
	dfs(d+1,num*10+4);
	dfs(d+1,num*10+8);
}
int main()
{
	dfs(0,0);
	sort(nubs.begin(),nubs.end());
	long long left,right;
	while(cin>>left>>right)
	{
		int ans=upper_bound(nubs.begin(),nubs.end(),right)-lower_bound(nubs.begin(),nubs.end(),left);
		cout<<ans<<endl;
	}
	return 0;
}
已经解决
© 2015 HUST ACMICPC TEAM. All Right Reserved.