摘要://这题和上题没什么区别// 就是数据大了点而已// 直接参考上题 http://www.cnblogs.com/372465774y/p/3604095.html#include #include #include#include #include #include #include #include using namespace std;#define LL long longLL C[40][40];int dp[40];void init(){ int i,j; for(i=0;i0) { index--; lf='z'-str[index]...
阅读全文
摘要:// 给你一个字符串 看下是否符合里面字符都是递增的// 如果是,那么求出他的编号// a是1号 ab是27号 .... 以此类推// 思路:给你的串长n 求长度为 1,2...n-1的合法串个数 C[26][1]+C[26][2]+...+C[26][n-1]// 求长度为n的串在同等长度里面排第几// 然后就OK了#include #include #include#include #include #include #include #include using namespace std;#define LL long longint C[40][40];int dp[40];vo..
阅读全文
摘要:// 求区间 [s,f]中有几个数在二进制表示下0的个数// 转化成求 0到某个值里面有多少这样的数// n二进制有m位 先求 1,2,3...m-1位二进制数里面有多少个符合// 再求n位里面比n小的二进制数里面有几个符合// 具体就是 将n写成二进制 从高位(m-1位)往地位枚举// 如果该位是1 则改成0 求剩下位数里面满足的情况总数// 如果该位是0 则不变 继续往下#include #include #include#include #include #include #include #include using namespace std;#define LL long lon.
阅读全文
摘要:// 11212312341234512345612345671234567812345678912345678910123456789101112345678910......// 给你个n 求上面的序列第n个数字是多少// 我是先按尾巴数字位数分组// 定义如下数据结构// 然后在求在确定位数里面的第几个// 再求这个子序列里面的某一位// 就是分组 归类的思想// 1Y ,看来思路清晰,代码清晰对于准确率来说是满重要,以前老是迷迷糊糊就开始写代码#include #include #include#include #include #include #include #include u
阅读全文
摘要:1/x + 1/y = 1/n 1n 那么设 x=n+m 那么 1/y= 1/n - 1/(n+m)// 1/y = m/(n*n+n*m) 所以满足 n*n|m 的m都是可以的 // 问题转化成求n*n 的约数个数 因数分解 然后用求约数个数公式// 最后答案记得 除 2 因为重复算了#include #include #include #include #include #include #include using namespace std;#define maxm 100010// #define maxn 47010#define LL __int64int prim[470...
阅读全文
摘要:The number of divisors(约数) about Humble NumbersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1741Accepted Submission(s): 852Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5,
阅读全文
摘要:Brave balloonistsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4546Accepted: 1924DescriptionTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork mak
阅读全文