
二分
追逐星辰的光
脚踏实地,虚心前行
展开
-
一生之敌-2017浙江中医药大学程序设计
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld 题目描述大家都知道Alice和Bob两个人是一生之敌。(雾 但某天,他们两个人发了疯。想知道他们两个是否可以成为朋友。 于是他们做了一个令人窒息的决定。 Alice和Bob每个人任意选一个整原创 2017-12-22 09:08:51 · 425 阅读 · 0 评论 -
POJ 1064 - Cable master
Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to co原创 2018-01-27 23:45:20 · 382 阅读 · 0 评论 -
POJ 1905 Expanding Rods
When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls and then heated,原创 2018-01-28 17:48:44 · 300 阅读 · 0 评论 -
POJ 2456 Aggressive cows
疯牛时间限制:1000 ms | 内存限制:65535 KB难度:4描述农夫 John 建造了一座很长的畜栏,它包括N (2 但是,John的C (2 输入有多组测试数据,以EOF结束。第一行:空格分隔的两个整数N和C第二行——第N+1行:分别指出了xi的位置输出每组测试数据输出一个整数,满足题意的最大的最小值,注意换原创 2018-01-28 22:18:05 · 236 阅读 · 0 评论 -
POJ 3258 River Hopscotch
每年奶牛们都要举办各种特殊版本的跳房子比赛,包括在河里从一块岩石跳到另一块岩石。这项激动人心的活动在一条长长的笔直河道中进行,在起点和距离起点 L 远的终点各有一块岩石 (1 ≤ L ≤ 10^9)。在起点和终点之间,有 N 块岩石 (0 ≤ N ≤ 50000),每块岩石与起点的距离分别为 Di (0 在比赛过程中,奶牛轮流从起点出发,尝试到达终点,每一步只能从一块岩石跳到另一块岩石。当然,原创 2018-01-29 10:22:10 · 297 阅读 · 0 评论 -
POJ 3273 Monthly Expense
描述给你一个长度为N的序列,现在要让你把他们切割成M份(所以每一份都是连续的),然后每一份都有一个和sum[i],其中最大的一个是maxSum = max(sum[i]),问这个最大值最小是多少?输入多组输入输出每组数据第一行是2个整数N,M(1i,表示这个序列.输出每组数据输出一行一个数,为这个最大值最小是多少输入样例7 510040030原创 2018-01-29 11:27:50 · 499 阅读 · 0 评论 -
POJ 2976 Dropping tests
今年有 n 场 ACM-ICPC 竞赛,小明每场都有资格参加。第 i 场竞赛共有 b[i] 道题。小明预测第 i 场他能做出 a[i] 道题。为了让自己看着更“大佬”一些,小明想让自己平均做出的题数越大越好,也就是最大化大佬度,大佬度的定义如下:为了达到这个目的,小明决定放弃 k 场比赛的参赛资格。请求出最大的大佬度。例如有 3 场小型比赛,题数分别是 5 题、1 题、6 题,小明预测原创 2018-01-29 18:18:50 · 334 阅读 · 0 评论 -
POJ 3111 K Best
Demy has n jewels. Each of her jewels has some value vi and weight wi.Since her husband John got broke after recent financial crises, Demy has decided to sell some jewels. She has decided that she w原创 2018-01-29 18:47:23 · 332 阅读 · 0 评论 -
CodeForces 535C Tavas and Karafs
给你两个整数A,B.给你一个无限长的序列,这个序列的第i个数字为A+(i-1)*B定义一个"m变态操作"为将不超过m个不同位置上的数字递减1.现在给你n个询问,每个询问由l,t,m决定.表示问你是否存在一个r,使得a[l],a[l+1],a[l+2]..a[r]这一段的数字,能在进行不超过t次"m变态操作"的限制下,全都变成0.(各个询问都是独立的,就是说,每个询问都是对原原创 2018-01-30 11:09:19 · 329 阅读 · 0 评论 -
CodeForces 660C Hard Process
给定一个数组 a,含有 n 个元素。数组 a 中的每个元素要么是 0,要么是 1 。让我们假定,数组 a 中,仅由数字 1 组成的连续元素所构成的子分段,其最长的长度为 f(a)。您可以将不超过 k 个 0 更改为 1,使得 f(a) 最大化。输入第一行包含了两个整数 n 和 k (1 ≤ n ≤ 3·105, 0 ≤ k ≤ n) — 数组 a 中的元素数目,和参数 k原创 2018-01-30 11:18:03 · 349 阅读 · 0 评论 -
HDU 4430 Yukari's Birthday
Today is Yukari's n-th birthday. Ran and Chen hold a celebration party for her. Now comes the most important part, birthday cake! But it's a big challenge for them to place n candles on the top of the原创 2018-01-26 23:05:17 · 407 阅读 · 0 评论 -
UVA 714 Copying Books
题意:有一个序列,由m个整数组成,把这个序列划分为k个连续的子序列,使得每个子序列和的最大值最小,要求划分的子序列的和是递增的,问如何划分。关于最大值的最小化问题,我们可以枚举子序列和的最大值,用二分的方法不断把最大值缩小,直到最优解,二分很容易,麻烦的就是我们如何划分,以及如何输出结果。int judge(ll x) { //判断子序列和的最大值是否可以划分 ll t = 0,原创 2018-01-26 14:01:40 · 241 阅读 · 0 评论 -
Tavas and Karafs CodeForces - 536A
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.Each Karafs has原创 2017-12-29 15:25:14 · 346 阅读 · 0 评论 -
CodeForces 165B Burning Midnight Oil
One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v原创 2018-01-05 20:14:52 · 330 阅读 · 0 评论 -
UVA 10341 Solve It
题目链接:https://vjudge.net/problem/UVA-10341意思是让解方程p*e-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x2 + u = 0直接二分求零点就行了。具体代码如下:#include #include #include #define fun(x) (p*exp(-x) + q*sin(x)原创 2018-01-06 21:17:58 · 340 阅读 · 0 评论 -
UVA 1152 4 Values whose Sum is 0
先讲述一下题意:有N组数据,每组数据第一行输入一个整数n,代表接下来有n行的输入,接下来输入n行,每行四个数A,B,C,D。从这n个A,B,C,D中各自挑选一个数,使得四个数的和为0,求满足条件的方案数。6-45 22 42 -16-41 -27 56 30-36 53 -37 77-36 30 -75 -4626 -38 -10 62-32 -54 -6 45原创 2018-01-25 10:12:59 · 204 阅读 · 0 评论 -
51Nod 1267 4个数和为0
第一次看这道题就知道是二分,我们可以两个数和的所有可能存到数组中,然后二分查找数组,可是遇到了一个问题,就是一些元素不可重复使用,比如2,-2 , 4 , 5 这种情况,会出现2+-2+2+-2 = 0,造成重复使用,所以二分就需要判断元素是否被重复使用。这样就不免有点麻烦,因为数据范围只有1000,可以想个简单点的方法,用双指针扫描。int solve(int n) { for(int i原创 2018-01-25 10:45:42 · 355 阅读 · 0 评论 -
HDU 2199 Can you solve this equation?
解方程:f(x) : 8*pow(x, 4) + 7*pow(x, 3) + 2*pow(x, 2) + 3*x + 6 = Y。二分精度查找,注意No solution的情况,f(0) Y。#include double pow(double x, int m) { double sum = 1; for(int i = 0; i < m; i++) { sum *= x;原创 2018-01-25 10:53:47 · 360 阅读 · 0 评论 -
CodeForces 165B Burning Midnight Oil
One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v原创 2018-01-25 12:54:17 · 286 阅读 · 0 评论 -
CodeForces 192A Funky Numbers
As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are tho原创 2018-01-25 23:00:45 · 394 阅读 · 0 评论 -
CodeForces 448D Multiplication Table
Bizon the Champion isn't just charming, he also is very smart.While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted an n ×原创 2018-01-25 23:04:21 · 335 阅读 · 0 评论 -
CodeForces 672D Robin Hood
We all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor.There are n citizens in Kekoland, each person原创 2018-01-30 11:46:32 · 321 阅读 · 0 评论