/*
数位dp
开一个二维数组用来储存前len状态对10取余,有10种状态0-9;
然后直接过一遍就行了
*/
#include
#include
#define ll __int64
#define N 20
ll digit[N],dp[N][11];
ll dfs(ll len,ll cnt,ll ok) {
if(!len) {
if(cnt==0)//如果可以整除返回1...
分类:
其他好文 时间:
2014-10-02 22:49:13
阅读次数:
187
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1058解题报告:输入一个n,输出第n个质因子只有2,3,5,7的数。用了离线打表,因为n最大只有5842。 1 #include 2 #define INT __int64 3 INT ans[5850]...
分类:
其他好文 时间:
2014-10-02 21:50:53
阅读次数:
1042
明显,当(X,Y)=1时,是可以看见的。这题,记得POJ 上也有类似的一题。。。不过比较奇怪的是,我以为会超时,因为范围达到了100000,但竟然直接枚举没超时。。。。#include #include #include #include #define LL __int64#define N 10...
分类:
其他好文 时间:
2014-10-02 18:06:23
阅读次数:
133
容斥原理简单应用#include #include #include #include #define LL __int64#define Np 100000using namespace std;bool isprime[Np];LL prime[Np],np;LL fac[100],fp;voi...
分类:
其他好文 时间:
2014-10-02 16:46:33
阅读次数:
157
呃,我竟然傻了,同时被a且b整除的个数为n/(a*b)。其实应该是n/[a,b]才对,是他们的最小公倍数啊。。。#include #include #include using namespace std;__int64 ans;__int64 set[30];__int64 n;int m;__i...
分类:
其他好文 时间:
2014-10-01 19:01:11
阅读次数:
184
切割木板的顺序是自由的,所以每次选择两块最短的板,组合在一起,加入队列,原来两个板出队,直到队列中为空或者只剩下一个板时结束。这里使用优先队列较为方便。
#include
#include
#include
#include
#include
#define ll __int64
using namespace std;
int len[20005];
int main()
{
//...
分类:
其他好文 时间:
2014-10-01 18:42:41
阅读次数:
150
----- 有时候如果枚举起点超时,那么试试枚举终点。枚举每一个i为终点(0i内相同字母的个数不超过k 1 #include 2 #include 3 const int N = 100000 + 10; 4 typedef __int64 LL; 5 char str[N]; 6 LL c...
分类:
其他好文 时间:
2014-09-29 21:07:21
阅读次数:
179
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5053解题报告:用来陶冶情操的题,求a到b的三次方的和。 1 #include 2 #include 3 #define INT __int64 4 int main() 5 { 6 int T,...
分类:
其他好文 时间:
2014-09-29 19:40:11
阅读次数:
217
1001.Alice and Bob签到题*1,只要x * 2 ==n && y * 2 == m就满足条件。1 var2 m, n, x, y : int64;3 4 begin5 while not eof do begin6 readln(m, n, x, y);7 ...
分类:
其他好文 时间:
2014-09-28 22:25:15
阅读次数:
422
直接lucas降到10w以内搞组合数
#include
#include
typedef __int64 LL;
LL f[110010];
LL pow(LL a, LL b, LL c)
{
LL ans = 1;
while(b)
{
if(b&1)
ans = (ans*a) % c;
b >>= 1;
a = (a*a) % c;
}
return an...
分类:
其他好文 时间:
2014-09-28 21:49:55
阅读次数:
216