
ACM_二分|三分
feng_zhiyu
这个作者很懒,什么都没留下…
展开
-
内部收益率(二分法)
在金融中,我们有时会用内部收益率IRR来评价项目的投资财务效益,它等于使得投资净现值NPV等于0的贴现率。换句话说,给定项目的期数T、初始现金流CF0和项目各期的现金流CF1, CF2, …,CFT,IRR是下面方程的解:为了简单起见,本题假定:除了项目启动时有一笔投入(即初始现金流CF0 < 0)之外,其余各期均能赚钱(即对于所有i=1,2,…,T,CFi > 0)。根据定义,IRR可以是负数,但原创 2017-08-07 15:48:45 · 3088 阅读 · 2 评论 -
(UVA - 11524) Values whose Sum is 0(二分+枚举)
链接: https://vjudge.net/problem/UVA-1152分析:最简单粗暴的方法 4个循环,但是一定TLE,然后a,b分别相加再枚举,复杂度降低了,和二分结合,时间复杂度降为O(n^2log(n))#include<cstdio>#include<set>#include<cstring>#include<sstream>#include<iostream>#incl原创 2017-08-13 15:57:56 · 377 阅读 · 0 评论 -
【PAT 甲级】1010 Radix (25)(二分法)
题目链接Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number.Now for any pair of positive ...原创 2018-07-11 15:57:57 · 339 阅读 · 0 评论 -
【PAT甲级】1085 Perfect Sequence (25)(二分法)
题目链接Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M <= m * p where M and m are the maximum and minimum numbers in the se...原创 2018-07-27 21:41:46 · 305 阅读 · 0 评论 -
【PAT甲级】1057 Stack (30)(BIT+二分)
题目链接Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) ...原创 2018-08-01 22:09:02 · 428 阅读 · 0 评论 -
【PAT甲级】1044 Shopping in Mars(25 分)(二分法)
题目链接Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any pos...原创 2018-08-24 14:35:44 · 534 阅读 · 0 评论