Codeforces1307B. Cow and Friend
本题的难点是可以在y轴正轴动,但也是突破点,知道x轴都是整数,那么对于任意长度来说,能到达的最短是1,最长是本身长度,那么我们就选择最长的距离,跳到一个点,使这个点为再跳就超过终点,那么就可以用2次跳跃到达终点,那么我们可以对终点距离/最大跳跃距离向上取整,与2的最大值为ans,除非一步可以到
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long LL; void run_case() {
LL n, x, tmp, Max=-;
bool flag = true;
cin >> n >> x;
for(int i = ; i < n; ++i) {
cin >> tmp;
if(tmp == x) {
flag = false;
}
Max = max(Max, tmp);
}
if(flag)
cout << max((LL)ceil((double)x/Max), 2LL) << "\n";
else cout << "1\n";
} int main() {
ios::sync_with_stdio(false), cin.tie();
//cout.setf(ios_base::showpoint);cout.precision(10);
int t; cin >> t;
while(t--)
run_case();
cout.flush();
return ;
}
Codeforces1307B. Cow and Friend的更多相关文章
- POJ 3278 Catch That Cow(bfs)
传送门 Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 80273 Accepted: 25 ...
- 【BZOJ1623】 [Usaco2008 Open]Cow Cars 奶牛飞车 贪心
SB贪心,一开始还想着用二分,看了眼黄学长的blog,发现自己SB了... 最小道路=已选取的奶牛/道路总数. #include <iostream> #include <cstdi ...
- HDU Cow Sorting (树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2838 Cow Sorting Problem Description Sherlock's N (1 ...
- [BZOJ1604][Usaco2008 Open]Cow Neighborhoods 奶牛的邻居
[BZOJ1604][Usaco2008 Open]Cow Neighborhoods 奶牛的邻居 试题描述 了解奶牛们的人都知道,奶牛喜欢成群结队.观察约翰的N(1≤N≤100000)只奶牛,你会发 ...
- 细读cow.osg
细读cow.osg 转自:http://www.cnblogs.com/mumuliang/archive/2010/06/03/1873543.html 对,就是那只著名的奶牛. //Group节点 ...
- POJ 3176 Cow Bowling
Cow Bowling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13016 Accepted: 8598 Desc ...
- raw,cow,qcow,qcow2镜像的比较
在linux下,虚拟机的选择方式有很多,比如vmware for linux,virtual box,还有qemu,在以前,使用qemu的人不多,主要是使用起来有些麻烦,但现在随着Openstack的 ...
- poj1985 Cow Marathon (求树的直径)
Cow Marathon Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 3195 Accepted: 1596 Case ...
- (01背包变形) Cow Exhibition (poj 2184)
http://poj.org/problem?id=2184 Description "Fat and docile, big and dumb, they look so stupid ...
随机推荐
- handler method 参数绑定
handler method 参数绑定常用的注解,我们根据他们处理的Request的不同内容部分分为四类:(主要讲解常用类型) A.处理requet uri 部分(这里指uri template中va ...
- Genetic Algorithm 资源
算法源码: NeuralGenetic : https://github.com/ahmedfgad/NeuralGenetic evolving-simple-organisms : https:/ ...
- gatling高性能测试工具
使用mvn命令直接测试. (loadrunner-----) 1.新建maven工程 2.在pom中导入依赖 <dependencies> <dependency> < ...
- Spring Boot 定时任务 Quartz 使用教程
Quartz是一个完全由java编写的开源作业调度框架,他使用非常简单.本章主要讲解 Quartz在Spring Boot 中的使用. 快速集成 Quartz 介绍 Quartz 几个主要技术点 Qu ...
- 吴裕雄 python 神经网络——TensorFlow 数据集高层操作
import tempfile import tensorflow as tf train_files = tf.train.match_filenames_once("E:\\output ...
- ANSYS初始残余应力赋值
目录 1.建模 2.划分网格并分组 3.所有节点固定约束 4.施加初始残余应力 5.结果 1.建模 建立有限元模型,采用SOLID185单元,模型尺寸0.050.050.02 材料为钢 !程序头 FI ...
- 【原】Jenkins pipeline中资料总结
docker-compose 快速部署持续集成测试环境 Gitlab+Harbor+Jenkins pipeline 实现 tag run docker Images https://www.cnbl ...
- 【原】Google浏览器刷新
- nginx反向代理实战之轮询、Ip_hash、权重
实验环境 192.168.200.111 web1 centos7 192.168.200.112 web2 centos7 192.168.200.113 wev3 centos7 三台主机环境: ...
- [python] pygame安装与配置
参考 https://www.runoob.com/python/python-install.html https://blog.csdn.net/huayuhuan/article/details ...