UVa 10474 - Where is the Marble?
来源:互联网 发布:天猫的数据魔方在哪里 编辑:程序博客网 时间:2024/06/04 19:10
10474 - Where is the Marble?
思路:例题5-1
关于.lower_bound():http://blog.csdn.net/niushuai666/article/details/6734403
#include <cstdio>]#include <cstring>#include <string>#include <iostream>#include <sstream>#include <cmath>#include <algorithm>#include <vector>#include <iomanip>#include <map>using namespace std;const int MAXN = 100000;int main(){int n, q, x, a[MAXN];int cas = 0;while (~scanf("%d%d", &n, &q) && n){printf("CASE# %d:\n", ++cas);for (int i = 0; i < n; i++)scanf("%d", &a[i]);sort(a, a + n);while (q--){scanf("%d", &x);int p = lower_bound(a, a + n, x) - a;if (a[p] == x) printf("%d found at %d\n", x, p + 1);else printf("%d not found\n", x);}}return 0;}
0 0
- 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?
- 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
- AppDelegate文件中代理调用的时间
- Java JDBC 实例
- 前置(后置)递增(递减)(读书笔记)
- 2016年腾讯模拟笔试“微信红包”问题
- 关于java单态模式的基本理解
- UVa 10474 - Where is the Marble?
- yum安装与问题处理
- 线性规划、梯度下降、正规方程组——斯坦福ML公开课笔记1-2
- Jetty无法debug追踪源码
- 局部加权回归、逻辑斯蒂回归、感知器算法—斯坦福ML公开课笔记3
- 总结
- namespace用法
- jquery+ajax+json
- java SDK及Android SDK环境配置