二分
white_156
星河滚烫,烫死人间理想;
皓月星辰 冻死人间曙光
展开
-
codeforces1359C. Mixing Water
题目链接现有两水源,一个热水h度,另一个凉水c度,然后你往体积无限的桶里一瓢热的一瓢凉的倒,问倒几瓢离t度最接近显然这题答案只有两种,要么是2,要么2n+12n+12n+1。 证明如下: - 当混合了$2n$次之后,温度td=n(h+c)2n=h+c2t_d = \frac{n(h+c)}{2n}=\frac{h+c}{2}td=2nn(h+c)=2h+c 可见偶数次混合后温度恒定 - 当混合了$2n+1$次后,温度td=n(h+c)+h2n+1t_d = \frac{n原创 2020-06-07 14:50:23 · 146 阅读 · 0 评论 -
leetcode 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers ...原创 2018-09-16 21:55:29 · 105 阅读 · 0 评论 -
leetcode 35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....原创 2018-09-17 17:34:58 · 81 阅读 · 0 评论 -
codeforces 1073C. Vasya and Robot
Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0,0). Robot can perform the following four kinds of operations: U — move from (x,y) to (x,y+1); D — mo...原创 2018-11-05 19:40:38 · 222 阅读 · 0 评论 -
EducationalCodeforcesRound60C. Magic Ship
You a captain of a ship. Initially you are standing in a point (x1,y1) (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point (x2,y2).You know the...原创 2019-03-04 19:44:20 · 232 阅读 · 0 评论