摘要: 向量叉积有甚多应用,包括求三角形面积,判断线段相交,求多边形面积,判断多边形凹凸性,而且不需要推大量公式,误差较小,非常实用,下面是代码 //向量叉积的应用#include #define EPS 1e-10using namespace std;struct point{ doubl... 阅读全文
posted @ 2015-01-02 12:40 Popco 阅读(411) 评论(0) 推荐(1) 编辑
摘要: 以前只是研究某两个进制A,B之间的转化,现在推广到任意进制。 其中十进制转为B进制:除B取余,倒序排列 目前的缺点是不能算小数和负数。 #include using namespace std;int toTen(const string & old, const int base){ ... 阅读全文
posted @ 2015-01-02 09:59 Popco 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 最近打算研究一下基础的算法,就先从二分开始做吧,三种方法 #include using namespace std;const int MAXN = 1024;int num[MAXN];//生成测试数据void init(){ for(int i = 0; i > 1; i... 阅读全文
posted @ 2015-01-02 08:52 Popco 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 中文描述: Description 给你一个5*6的矩阵,矩阵里每一个单元都有一个灯和一个开关,如果按下此开关,那么开关所在位置的 那个灯和开关前后左右的灯的状态都会改变 (即由亮到不亮或由不亮到亮)。给你一个初始的灯的状态, 问怎样控制每一个开关使得所有的灯最后全部熄灭。 Input 输... 阅读全文
posted @ 2014-12-29 22:35 Popco 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Sum Sum Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 166 Accepted Submission(s):... 阅读全文
posted @ 2014-12-29 18:41 Popco 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calcu... 阅读全文
posted @ 2014-12-24 09:24 Popco 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the inter... 阅读全文
posted @ 2014-12-24 08:46 Popco 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Problem Description Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO". Input each test case contains two nu... 阅读全文
posted @ 2014-12-21 14:26 Popco 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Problem Description 国庆期间,省城HZ刚刚举行了一场盛大的集体婚礼,为了使婚礼进行的丰富一些,司仪临时想出了有一个有意思的节目,叫做"考新郎",具体的操作是这样的: 首先,给每位新娘打扮得几乎一模一样,并盖上大大的红盖头随机坐成一排; 然后,让各位新郎寻找自己的新娘... 阅读全文
posted @ 2014-12-21 08:12 Popco 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 这个题,要用到错排递推公式,还有全排。 还有,最近比赛啥的老是不爽,结果通过这个题竟然发现了自己的毛病,printf(“%lf”)输出double型怎么弄也是输出0.00,调试了半天,还以为C语言编译器犯病了。后来才知道输出时应该用f,无语了。发现自己太水了。。。好好努力吧。。 #inclu... 阅读全文
posted @ 2014-12-20 22:37 Popco 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Problem Description Now our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Prince... 阅读全文
posted @ 2014-12-20 09:23 Popco 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Problem Description Fibonacci数列,定义如下: f(1)=f(2)=1 f(n)=f(n-1)+f(n-2) n>=3。 计算第n项Fibonacci数值。 Input 输入第一行为一个整数N,接下来N行为整数Pi(1<=Pi<=1000)。 ... 阅读全文
posted @ 2014-12-20 09:05 Popco 阅读(143) 评论(0) 推荐(0) 编辑
摘要: How Many Fibs? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4592 Accepted Submission(... 阅读全文
posted @ 2014-12-18 23:41 Popco 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Exponentiation Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7275 Accepted Submission(s... 阅读全文
posted @ 2014-12-18 22:58 Popco 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Integer Inquiry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13470 Accepted Submissio... 阅读全文
posted @ 2014-12-18 22:09 Popco 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 方法一:最简单的方法,直接使用STL中的next_permutation函数生成排列 #include using namespace std;int main(){ char res[] = "ABCD"; do{ puts(res); }while(next... 阅读全文
posted @ 2014-12-18 16:40 Popco 阅读(790) 评论(0) 推荐(0) 编辑
摘要: The sequence of n - 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime nu... 阅读全文
posted @ 2014-12-17 20:42 Popco 阅读(141) 评论(0) 推荐(0) 编辑
摘要: A: Zombie's Treasure Chest Some brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treas... 阅读全文
posted @ 2014-12-17 20:41 Popco 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Count on Cantor One of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enum... 阅读全文
posted @ 2014-12-17 08:47 Popco 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the b... 阅读全文
posted @ 2014-12-16 16:06 Popco 阅读(173) 评论(0) 推荐(0) 编辑