coldheart's blog

VOJ 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, it expands and takes the shape of a circular segment, the original rod being the chord of the segment. Your task is to compute the distance by

VOJ Aggressive Cows(二分法查找最小值最大)

VOJ Aggressive cows 描述 Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,xN (0 <= xi <= 1,000,000,000). His C (2 <= C <= N) cows don’t like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurting each other, FJ

ZCMCMU1639 残缺的棋盘

ZCMU1639 残缺的棋盘 Description 在国际象棋里,王是最重要的一个棋子。每一步,王可以往上下左右或者对角线方向移动一 步,如下图所示。给定两个格子 A(r1,c1), B(r2,c2)

ZCMU1398 工程

ZCMU1398 工程 Description 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择

ZCMU1265 数三角形

ZCMU1265 数三角形 Description 给定一个等边三角形,它的每条边被分成n等分,分别用平行于三边的直线过各个n等分点截这个三角形,如图所示: 请问,图中总共有多少个三

ZCMU2163 项链

ZCMU2163 项链 Description 强迫症非常麻烦,尤其是买东西的时候。冠璐女神的生日快到了,某强迫症要送一条项链送给她,重点是,这条项链要对称,这条项链要对称,这条项

牛客网 Different Integers

牛客网 Different Integers 题目描述 Given a sequence of integers a1, a2, …, an and q pairs of integers (l1, r1), (l2, r2), …, (lq, rq), find count(l1, r1), count(l2, r2), …, count(lq, rq) where count(i, j) is the number of different integers among a1, a2, …, ai, aj, aj + 1, …, an. 输入描述 The input consists of several test cases and

在线和离线算法

在OI/ACM中,我们常常会听到对于区间修改、区间查询等问题的处理时,大佬们口中说的“离线”,“在线”等名词,一开始自然是一脸蒙逼。 在线和离

洛谷P1060 开心的金明

洛谷P1060 开心的金明 题目描述 金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对

ZCMU1980 不存在的泳池

ZCMU 1980 不存在的泳池 Description 小w是云南中医学院的同学,有一天他看到了学校的百度百科介绍: 截止到2014年5月,云南中医学院图书馆纸本藏书74.8457