poj Code(组合数)】的更多相关文章

Code Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9918   Accepted: 4749 Description Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system…
    主要考察组合数知识,初始化的时候参考公式 首先先推个公式,就是长度为len的Round Numbers的个数.      长度为len,第一位肯定是1了.      那么后面剩下 len-1位.      如果len-1是偶数.      那么  C(len-1,(len-1)/2+1)+C(len-1,(len-1)/2+2)+````C(len-1,len-1) =   ( 2^(len-1)-C(len-1,(len-1)/2) )/2;     如果len是奇数    那么就是 …
Code the Tree Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2259   Accepted: 859 Description A tree (i.e. a connected graph without cycles) with vertices numbered by the integers 1, 2, ..., n is given. The "Prufer" code of such a…
Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7184   Accepted: 3353 Description Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is th…
http://poj.org/problem?id=1850 题意 :给定字符串,系统是用字符串组成的,字符串是按字典序排的.编码系统有三条规则,1这些的单词的长度是由小到大的,2相同长度的按字母在字典序的顺序排的,3 a-1,b-2,.....z-26,ab-27,..........,az-51,bc-52,............,vwxyz - 83681,..................输入的是长度不超过10的全为小写英语字母的字符串,让你输出对应的数字,如果并没有按照顺序,则输出…
http://poj.org/problem?id=3904   题意:给一些数,求在这些数中找出四个数互质的方案数.   莫比乌斯反演的式子有两种形式http://blog.csdn.net/outer_form/article/details/50588307 这里用的是第二种形式. 求出四个数的公约数为x的倍数的方案数,即可得到,四个数的公约数为x的方案数. 这里x为1. 代码 #include<cstdio> #include<cstring> #include<io…
B - Sky Code Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3904 Description Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. Tha…
http://poj.org/problem?id=1942 题意 :在一个n*m的矩形上有n*m个网格,从左下角的网格划到右上角的网格,沿着边画,只能向上或向右走,问有多少条不重复的路 . 思路 :这种问题记得高中的时候就做过,学组合数的时候讲的,反正就是向上向右走,加起来要走的路必定为n+m条,选择n条向上,必定剩下的m为向右的,所以这个题就转化求C(n,m+n),或者是C(m,m+n),不过个人建议用m,n中小的那个数去做,因为省时.因为这个数据较大,所以求组合的时候就要注意以防超时,如果…
题目链接: http://poj.org/problem? id=1780 Code Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2037   Accepted: 751 Description KEY Inc., the leading company in security hardware, has developed a new kind of safe. To unlock it, you don't nee…
Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequence. It is considered that the words ar…