Educational Codeforces Round 2 B. Queries about less or equal elements
题意:给2个数组(无序的)啊a,b,判断b数组中的每一个元素大于a数组中个数。
ACcode:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
vector<int> v;
int main()
{
int x, n, m;
scanf("%d%d",&n,&m);
for(int i=0; i<n; i++)
{
scanf("%d",&x);
v.push_back(x);
}
sort(v.begin(),v.end());
for(int i=0; i<m; i++)
{
scanf("%d", &x);
int pos = lower_bound(v.begin(),v.end(), x+1)- v.begin();
printf("%d ",pos);
}
printf("\n"); return 0;
}
lower_bound的详细: 参考链接
vector的详细:参考链接
Educational Codeforces Round 2 B. Queries about less or equal elements的更多相关文章
- Educational Codeforces Round 2 B. Queries about less or equal elements 水题
B. Queries about less or equal elements Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforc ...
- Educational Codeforces Round 1 B. Queries on a String 暴力
B. Queries on a String Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/59 ...
- POJ-2926-Requirements&&Educational Codeforces Round 56G. Multidimensional Queries 【哈夫曼距离】
POJ2926 先学会这个哈夫曼距离的处理才能做 cf 的G #include <iostream> #include <stdio.h> #include <algor ...
- Educational Codeforces Round 2_B. Queries about less or equal elements
B. Queries about less or equal elements time limit per test 2 seconds memory limit per test 256 mega ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Educational Codeforces Round 65 (Rated for Div. 2)题解
Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...
- Educational Codeforces Round 41 967 E. Tufurama (CDQ分治 求 二维点数)
Educational Codeforces Round 41 (Rated for Div. 2) E. Tufurama (CDQ分治 求 二维点数) time limit per test 2 ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
随机推荐
- Linux问题分析或解决_ssh无法连接
1. ldd - 检查依赖库是否存在问题 问题:ssh连接不上,之前一直没有问题,最近别人安装了其他桌面(系统Ubuntu) 解决: 查看进程,发现没有启动 ps -ef | grep ssh 重新安 ...
- select值改变
改变select的值,然后执行一个方法.可以用chang: $("#select").change(function(){ //要执行的内容 });
- 访问远程mysql数据库,出现报错,显示“1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server“
在使用Navicat for MySQl访问远程mysql数据库,出现报错,显示“1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to t ...
- 笔记--tslib 编译
tslib 是qt启动时的一个触屏校正检验程序. 它的配置以及编译比较简单. 第一步, 下载tslib源码包: http://download.csdn.net/detail/MKNDG/329156 ...
- 1014-31-首页12-显示weibo未读数--后台运行---定时器
/** * 当app进入后台时调用 */- (void)applicationDidEnterBackground:(UIApplication *)application{ /** ...
- McNay Art Museum【McNay艺术博物馆】
McNay Art Museum When I was 17, I read a magazine artice about a museum called the McNay, once the h ...
- MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':ge
数据库表里命名有这个字段,可怎么就是报错呢,大神的解释: 加上之后立马好用!!!
- 利用js实现倒计时
倒计时 这个名词并不陌生,比如:天猫,京东等一些网上商城都会推出一些限时特价商品,今天我们就一起编写一个属于自己的倒计时: Ps: 首先做一件事情的时候,不应该盲目的去做,应该首当其冲的去想,脑子里面 ...
- User_Authentication_Personalization Model
花了一天时间实现了一个 简单的用户登录验证的小模型. 基本实现了现在 用户登录模块的绝大多数功能, 也算是 熟悉了一下系统的逻辑. 在这个小模型中, 实现了以下的基本功能 : Logging in a ...
- 多路复用IO模板
服务端 from socket import * import select server = socket(AF_INET, SOCK_STREAM) server.bind(('127.0.0.1 ...