2017-08-26 11:38:42 writer:pprp 已经是第二次写这个题了,但是还是出了很多毛病 先给出AC代码: 解题思路: 之前在培训的时候只是笼统的讲了讲怎么做,进行二分对其中一边进行暴力枚举,对另一边用lower_bound查找算出的相反数 现在给出详细一点的思路: 答案可能在左边枚举的部分,也可能在右边枚举的部分,也可能在两边加起来的和中 所以从这三个方面不能少考虑: 还有用到了map所以算出来的key是唯一的,所以当算出来两个key相等的时候,应该采用value也就是cn…
E. Simple Skewness 题目连接: http://www.codeforces.com/contest/626/problem/E Description Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Fi…
题目描述 Given a list of N integers with absolute values no larger than 10 15, find a non empty subset of these numbers which minimizes the absolute value of the sum of its elements. In case there are multiple subsets, choose the one with fewer elements.…
A. Beru-taxi time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as…
Subsequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10875   Accepted: 4493 Description A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) ar…
一元三次方程求解 描述 有形如:ax^3+bx^2+cx+d=0 这样的一个一元三次方程.给出该方程中各项的系数(a,b,c,d 均为实数),并约定该方程存在三个不同实根(根的范围在-100至100之间),且根与根之差的绝对值>=1.要求由小到大依次在同一行输出这三个实根(根与根之间留有空格),并精确到小数点后2位. 格式 输入格式 输入该方程中各项的系数(a,b,c,d 均为实数), 输出格式 由小到大依次在同一行输出这三个实根(根与根之间留有空格),并精确到小数点后2位. 样例1 样例输入1…
为甚么16年Qingdao Online 都是暴力题emm///... 先暴力预处理 然后lower _bound二分 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include <set> #include <vector> #incl…
LINK 题意:给出n个点,每个点有个权值,可以和任意另外一点构成线段,值为权值积.现问过原点的直线中交所有线段的权值和的最大值,注意直线必不经过点. 思路:直线可以将点集分为两侧,此时的权值为两侧点的乘积.而且由于是过原点的直线,所以不用暴力枚举两个点了...直接极角排序,这里我原先的极角排序有点小问题,最后还是找的别人的,以(0,x)为最小极角的. 然后前缀和权值以便分组求积. 枚举点,与原点相连作直线,然后以枚举点的对称点,二分找到最大的在它顺时针侧的点,然后注意要注意枚举点是否包含的两种…
B. Lorry 题目连接: http://www.codeforces.com/contest/3/problem/B Description A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that a…
D. Image Preview 题目连接: http://www.codeforces.com/contest/651/problem/D Description Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over…