Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] C C Problem about Polyline 数学
1 second
256 megabytes
There is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – ....
We know that the polyline passes through the point (a, b). Find minimum positive value x such that it is true or determine that there is no such x.
Only one line containing two positive integers a and b (1 ≤ a, b ≤ 109).
Output the only line containing the answer. Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 9. If there is no such x then output - 1 as the answer.
3 1
1.000000000000
1 3
-1
4 1
1.250000000000
Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] C C Problem about Polyline 数学的更多相关文章
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] C. Weakness and Poorness 三分 dp
C. Weakness and Poorness Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] B. "Or" Game 线段树贪心
B. "Or" Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578 ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] B. "Or" Game
题目链接:http://codeforces.com/contest/578/problem/B 题目大意:现在有n个数,你可以对其进行k此操作,每次操作可以选择其中的任意一个数对其进行乘以x的操作. ...
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] E. Weakness and Poorness 三分
E. Weakness and Poorness time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] A. Raising Bacteria【位运算/二进制拆分/细胞繁殖,每天倍增】
A. Raising Bacteria time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] D 数学+(前缀 后缀 预处理)
D. "Or" Game time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Codeforces Round #320 (Div. 2) [Bayan Thanks-Round] E 三分+连续子序列的和的绝对值的最大值
E. Weakness and Poorness time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] C A Weakness and Poorness (三分)
显然f(x)是个凹函数,三分即可,计算方案的时候dp一下.eps取大了会挂精度,指定循环次数才是正解. #include<bits/stdc++.h> using namespace st ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] B "Or" Game (贪心)
首先应该保证二进制最高位尽量高,而位数最高的数乘x以后位数任然是最高的,所以一定一个数是连续k次乘x. 当出现多个最高位的相同的数就枚举一下,先预处理一下前缀后缀即可. #include<bit ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] A A Problem about Polyline(数学)
题目中给出的函数具有周期性,总可以移动到第一个周期内,当然,a<b则无解. 假设移动后在上升的那段,则有a-2*x*n=b,注意限制条件x≥b,n是整数,则n≤(a-b)/(2*b).满足条件的 ...
随机推荐
- vue cli本地开发跨域问题解决
首先呢,找到在目录里找到config文件夹 然后修改config文件夹下的index.js里面dev的配置项proxyTable: 修改为: proxyTable: { '/api': { targe ...
- [Python3网络爬虫开发实战] 1.5.1-PyMySQL的安装
在Python 3中,如果想要将数据存储到MySQL中,就需要借助PyMySQL来操作,本节中我们介绍一下它的安装方式. 1. 相关链接 GitHub:https://github.com/PyMyS ...
- 零基础入门学习Python(5)--闲聊之Python的数据类型
前言 本次主要闲聊一下python的一些数值类型,整型(int),浮点型(float),布尔类型(bool),还有e记法(科学计数法),也是属于浮点型. 数值类型介绍 整型 整型就是我们平时所说的整数 ...
- linux与linux之间共享目录
1.安装必要的包 nfs-utils rpcbind (nfs是基于sun公司的rpc通信实现的,所以要装rpcbind) 这2包,在服务端和客户端都需要安装,并启动服务. 启动 ...
- 性能测试培训day2
上节课 性能测试,多线程.协议.场景 实施:1,脚本开发 运行 排错(看回放,然后view-test_results,看业务) 参数化.关联.检查点.事务.思考时间.集合点 参数化:不做参数化的话, ...
- UVa 11998 破碎的键盘(数组实现链表)
题意: 输入一行字符,其中包含'[' 和 ‘]’, 意思为键盘上的home 和 end 键, 然后模拟字符在键盘上输入. 输入一行最终的结果 分析: 用数组模拟一个链表, 在链表的头尾插入字母然后输出 ...
- 商业研究(21):活力蛙,足疗O2O,曾经的“中国上门足疗领先品牌”
友情提示:商业研究系列文章,只探讨项目和相关项目的商业本身,不针对任何人和任何组织!!! 2015年,在京东-东家 股权众筹平台,参与投资了足疗O2O项目,活力蛙. 后来由于,股市大跌和资本寒 ...
- js高级程序设计第八章BOM(未完成,待续)
8.1window对象 BOM的核心对象是window,表示浏览器的一个实例. window对象有双重角色,既可以通过就是访问浏览器窗口的接口,又是ECMAscript规定的Global对象 8. ...
- 全文搜索(AC-1)-互联网信息过载问题
什么是信息过载? 信息检索技术是什么? 信息过滤技术是什么?
- CSU 1258 异或运算的线段树
题目大意:在给定区间内对每个数的最后一个二进制为1的位将其修改为0,如果数本身已经为0了,就不做改变 输出给定区间的所有数的异或值 #include <cstdio> #include & ...