您的位置:首页 > 其它

UVAlive 6426 Count 读入二进制文件

2016-09-11 19:05 363 查看
//题目:http://www.51isoft.com/v3/external/64/6426.pdf

//参考:http://blog.csdn.net/u013007900/article/details/48090897

#include <stdio.h>
#include <string>
#include <cstring>
#include <queue>
#include <algorithm>
#include <functional>
#include <vector>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <iostream>
#include <sstream>
#include <time.h>
#include <stack>
#include <set>
#include <map>
#include <time.h>
#include <bitset>
using namespace std;
int A[10005][10005];
bool read(int *a, int n)
{
return fread(a,4,n,stdin);
}
int main()
{
int n, m;
read(&n,1);
read(&m,1);
for(int i=0; i<n; i++)
read(A[i],m);
int l,r;
while(read(&l,1)&&read(&r,1))
{
int ans=0;
for(int i=0; i<n; i++)
{
int lpos=lower_bound(A[i],A[i]+m,l)-A[i];
int rpos=upper_bound(A[i],A[i]+m,r)-A[i];
if(rpos>lpos) ans+=rpos-lpos;
}
printf("%d\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: