uva10474
来源:互联网 发布:nba2k14中文版下载软件 编辑:程序博客网 时间:2024/05/17 07:02
#include<iostream>
#include<algorithm>
using namespace std;
int mm[10001];
int nn[10001];
int main()
{
int m,n,i,pos,cas=1;
while(cin>>m>>n&&m!=0&&n!=0)
{
for(i=0;i<m;i++)
{
cin>>mm[i];
}
for(i=0;i<n;i++)
{
cin>>nn[i];
}
cout<<"CASE# "<<cas<<':'<<endl;
sort(mm,mm+m);
for(i=0;i<n;i++)
{
pos=lower_bound(mm,mm+m,nn[i])-mm;
if(mm[pos]==nn[i])
{
pos++;
cout<<nn[i]<<" found at "<<pos<<endl;
}
else
{
cout<<nn[i]<<" not found"<<endl;
}
}
cas++;
}
return 0;
}
#include<algorithm>
using namespace std;
int mm[10001];
int nn[10001];
int main()
{
int m,n,i,pos,cas=1;
while(cin>>m>>n&&m!=0&&n!=0)
{
for(i=0;i<m;i++)
{
cin>>mm[i];
}
for(i=0;i<n;i++)
{
cin>>nn[i];
}
cout<<"CASE# "<<cas<<':'<<endl;
sort(mm,mm+m);
for(i=0;i<n;i++)
{
pos=lower_bound(mm,mm+m,nn[i])-mm;
if(mm[pos]==nn[i])
{
pos++;
cout<<nn[i]<<" found at "<<pos<<endl;
}
else
{
cout<<nn[i]<<" not found"<<endl;
}
}
cas++;
}
return 0;
}
阅读全文
0 0
- uva10474
- UVA10474
- uva10474
- Uva10474
- UVA10474
- uva10474
- UVA10474
- Uva10474
- UVA10474
- uva10474
- Uva10474
- sort--uva10474
- UVA10474-弹珠在哪里
- e5-1 uva10474
- uva10474 (二分查找)
- UVa10474(排序和查找)
- UVA10474查找优化
- uva10474 - Where is the Marble?
- Java并发编程:Thread类的使用
- 在主方法中创建String型变量,实现字符变量的大小写转换,并将转换后的结果输出
- 右键菜单事件
- [笔记]: 树链剖分
- IO流的一些知识点
- uva10474
- 0.masm32-搭建环境和MessageBoxA弹框
- python 入门
- 【java】-- JDBCDemo:连接,简单增删查改
- Android 之 ListView 的焦点问题
- Spring Boot属性配置文件详解
- Linux常用命令大全
- 前后端分离项目的技术与框架通用方案
- jQuery全选全不选第二次失效问题解决办法