UVA 10474 Where is the Marble? (STL)
来源:互联网 发布:护肤品成分查询软件 编辑:程序博客网 时间:2024/05/17 01:51
给出石头的大小,排序后 有多次查询 每次查询是否有石头在队列中
不用lower_bound应该也能过
#include<iostream>#include<cstdio>#include<set>#include<string>#include<string.h>#include<cstring>#include<vector>#include<map>#include<queue>#include<stack>#include<cctype>#include<algorithm>#include<sstream>#include<utility>#include<cmath>#define mt(a) memset(a,0,sizeof (a))#define fl(a,b,c) fill(a,b,c)#define SWAP(a,b,t) (t=a,a=b,b=t)#define inf 1000000using namespace std;typedef long long ll;ll a[500000];int main(){int T;int cot = 0; int n, m;while (cin >> n >> m){cot++;if (n == 0 && m == 0)break;for (int i = 0; i < n; i++)scanf("%lld", &a[i]);sort(a, a + n);printf("CASE# %d:\n", cot);for (int i = 0; i < m; i++){ll find;scanf("%lld", &find);ll pos = lower_bound(a, a + n, find)-a;if (a[pos] == find)printf("%lld found at %lld\n", find, pos + 1);else printf("%d not found\n", find);}}return 0;}
0 0
- UVA 10474 Where is the Marble? (STL)
- UVa - 10474 Where is the Marble?(STL)
- uva 10474 Where is the Marble?(二分STL)
- UVA 10474:Where is the Marble?(STL初步)
- UVA - 10474 Where is the Marble?(STL,水)
- UVA 10474 Where is the Marble? 暴力|STL
- UVA 10474 Where is the Marble? (STL最简单运用)
- UVA 10474 Where is the Marble(stl,sort)
- UVa 10474Where is the Marble STL 模板练习
- UVa 10474 Where is the Marble?
- Uva 10474 Where is the Marble?
- uva 10474 Where is the Marble?
- UVA 10474 Where is the Marble?
- UVA 10474 - Where is the Marble
- uva-10474 - Where is the Marble?
- uva 10474 - Where is the Marble?
- UVA 10474 - Where is the Marble?
- UVa 10474 - Where is the Marble?
- 将1234567890转换成1,234,567,890每3位用逗号隔开的形式(百度)
- leetcode之H-index &&H-index II
- 手动操作导航控制器的子视图控制器的数组
- 【数据结构与算法】五 兔子数列 斐波那契数列
- 《leetCode》:Triangle
- UVA 10474 Where is the Marble? (STL)
- 文件IO
- HDU 5620 KK's Steel 斐波那契
- pyhton处理字符串(1)
- 《Unix高级环境编程》第八章 进程控制
- 算法竞赛入门经典第六章习题
- win7系统64位oracle11g服务端安装详述
- BZOJ 2111: [ZJOI2010]Perm 排列计数|组合数学|Lucas定理|DP
- java基础-& 与运算