#include <bits/stdc++.h>
using namespace std; const int maxn=;
int main()
{
int n,q,x;
int kase=;
int a[maxn];
while(cin>>n>>q)
{
if(n== && q==)
break;
cout<<"CASE# "<<++kase<<":"<<endl;
for(int i=;i<=n;i++)
cin>>a[i];
sort(a+,a+n+);
while(q--)
{
cin>>x;
int t=lower_bound(a+,a+n+,x)-a;
if(a[t]==x)
cout<<x<<" found at "<<t<<endl;
else
cout<<x<<" not found"<<endl;
}
}
return ;
}

同样的模板,改了几个变量就一直超时,改了一早上也没发现什么问题

UVa10474的更多相关文章

  1. Uva10474 - Where is the Marble?

      两种解法: 1.计数排序 //计数排序 #include<cstdio> #include<iostream> #include<vector> #includ ...

  2. uva10474 简单排序查找 一次AC

    题目很简单,加上读题20分钟一次AC.还是用到了快排qsort. #include<iostream> #include<cstdlib> using namespace st ...

  3. 排序与检索【UVa10474】Where is the Marble?

    Where is the Marble?  DescriptionRaju and Meena love to play with Marbles. They have got a lot of ma ...

  4. 大理石在哪儿(UVa10474)

    题目具体描述见:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=835&a ...

  5. UVA10474 Where is the Marble?【排序】

    参考:https://blog.csdn.net/q547550831/article/details/51326321 #include <iostream> #include < ...

  6. 算法习题---5.1大理石在哪(UVa10474)

    一:题目 现有N个大理石,每个大理石上写了一个非负整数.首先把各数从小到大排序,然后回答Q个问题.每个问题问是否有一个大理石写着某个整数x,如果是,还要回答哪个大理石上写着x.排序后的大理石从左到右编 ...

  7. UVa10474 Where is the Marble?(排序sort)

    今天开始学STL,这是书上的一道例题,主要是用了sort函数和lower_bound函数,挺容易理解的. lower_bound的作用是查找“大于或等于x的第一个位置”. 需要注意的是,不要忘记alg ...

  8. 5_1 大理石在哪儿(UVa10474)<排序与查找>

    Raju和Meena喜欢玩弹珠,他们有许多上面有号码的弹珠.一开始时,Raju按照弹珠上面的号码由小到大排成一列,然后Meena会要求Raju找出某个号码的第一颗弹珠所在的位置.她会算1…2…3…,如 ...

  9. UVA 10474 - Where is the Marble?--vector

    https://vjudge.net/problem/UVA-10474 https://blog.csdn.net/xiyaozhe/article/details/81081344 简单用法 so ...

随机推荐

  1. 数组Array的API1

    数组的方法arr.includes()arr.every(fn(val,i))arr.some(fn(val,i))arr.filter(fn(val,i))arr.map(fn(val,i))ar. ...

  2. LeetCode 104. Maximum Depth of Binary Tree二叉树的最大深度 C++/Java

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  3. hml页面转化成图片

    <!DOCTYPE html><html><head><meta charset="utf-8"><meta name=&qu ...

  4. 9Linux_LVM_iptables

    LVM 创建物理卷 卷组 逻辑卷 格式化 挂载 扩容 缩小 快照 删除逻辑卷

  5. 深度学习原理与框架- tf.nn.atrous_conv2d(空洞卷积) 问题:空洞卷积增加了卷积核的维度,为什么不直接使用7*7呢

    空洞卷积, 从图中可以看出,对于一个3*3的卷积,可以通过使用增加卷积的空洞的个数,来获得较大的感受眼, 从第一幅图中可以看出3*3的卷积,可以通过补零的方式,变成7*7的感受眼,这里补零的个数为1, ...

  6. 循环队列搜索 Search in Rotated Sorted Array

    这里比较重要的是,不要一上来就判断mid 和 target有没有关系.因为数组是无序的,这样的判断毫无结论,只会搞的更复杂.应该先想办法判断出哪一侧是有序的. class Solution { pub ...

  7. Linux OS7 常用

    查看防火墙状态: firewall-cmd --state;停止firewall: systemctl stop firewalld.service;禁止firewall开机启动:systemctl ...

  8. Python中函数和方法的区别

    方法是一种特殊的函数属于某个类的的函数叫方法不属于某个类的函数叫函数 转自csdn https://blog.csdn.net/weixin_40380298/article/details/7825 ...

  9. 安装VMware tools

    1.发现在vmware中无法复制粘贴,经查询后Centos精简版是没有VMware tools的.2.df是用来看磁盘空间使用情况的.3.rpm包的格式:name+version(主版本+此版本+修正 ...

  10. Arthas的基础学习

    下载与安装 wget https://alibaba.github.io/arthas/arthas-boot.jar java -jar arthas-boot.jar 启动 查看启动的帮助信息: ...