ACM篇:UVa 10474--Where is the Marble?
来源:互联网 发布:淘宝的购物记录怎么查 编辑:程序博客网 时间:2024/05/19 15:24
STL练习
#include <iostream>#include <cstdio>#include <algorithm>#include <vector>using namespace std;int n;int q;vector<int> marble;void read_marble(){ marble.clear(); int v; for (int i = 1; i <= n; i++) { scanf("%d", &v); marble.push_back(v); }}int main(){ int kase = 0; while (scanf("%d%d", &n, &q) == 2 && (n || q)) { read_marble(); sort(marble.begin(), marble.end()); printf("CASE# %d:\n", ++kase); int tar; int index; while (q--) { scanf("%d", &tar); index = lower_bound(marble.begin(), marble.end(), tar) - marble.begin(); if (marble[index] == tar) { printf("%d found at %d\n", tar, index+1); } else { printf("%d not found\n", tar); } } }}
0 0
- ACM篇: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?
- Java类加载器classLoader的工作机制
- android Application类的详细介绍
- HDFS格式化报错
- memcached+magent实现memcached集群
- QT ini文件读写
- ACM篇:UVa 10474--Where is the Marble?
- 正式入驻
- 百度前端技术学院 JavaScript Task 01
- tomcat里的servlet就是线程相关的问题!
- 磁盘空间满了之后MySQL会怎样
- java自带线程池和队列详细讲解
- SpringBoot 配置 web.xml
- sprintf(),sscanf()函数的使用
- 【大话模式】-总览图