Binary Witch http://poj.org/problem?id=2541 Time Limit: 1000MS Memory Limit: 65536K Description Once upon a time in the silent depths of digital forests there lived a Binary Witch. She was able to forecast weather, telling for any day in the…
相应POJ 题目:点击打开链接 Binary Search Heap Construction Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 9075 Accepted: 2566 Description Read the statement of problem G for the definitions concerning trees. In the following we define the basic…
Binary Stirling Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 1761 Accepted: 671 Description The Stirling number of the second kind S(n, m) stands for the number of ways to partition a set of n things into m nonempty subsets.…
Binary codes Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5647 Accepted: 2201 Description Consider a binary string (b1-bN) with N binary digits. Given such a string, the matrix of Figure 1 is formed from the rotated versions of the…
题意:二叉树的根节点为(1,1),对每个结点(a,b)其左结点为 (a + b, b) ,其右结点为 (a, a + b),已知某结点坐标,求根节点到该节点向左和向右走的次数. 分析:往回一步一步走肯定超时,不过如果a>b,大的有点多,就没必要一步一步走,直接a/b就好了,然后把a变成a%b取余,那么a/b就是从现在的a到原来的a向左走的步数.(a<b同理) 同理,如果a=1的话,那么也没必要往回走了,因为从根节点到现在的结点就是向右走了b-1.(b=1同理) #pragma comment(…