mad_max
mad_max
全部文章
分类
主席树(1)
优先队列(3)
博弈论(2)
哈希(3)
广度优先搜索(2)
数论(8)
未归档(1)
树(2)
树状数组(3)
模拟(4)
深度优先搜索(6)
线段树(3)
贪心(2)
归档
标签
去牛客网
登录
/
注册
mad_max的博客
全部文章
(共40篇)
莫比乌斯函数(数论)
在莫比乌斯反演中用到的重要公式 以下是莫比乌斯函数模板 const int MAXN = 1000000; bool check[MAXN+10]; int prime[MAXN+10]; int mu[MAXN+10]; void Moblus() { memset(check,fal...
2019-08-25
0
442
HDUOJ 1280 前m大的数 (hash)
Problem Description 给定一个包含N(N<=3000)个正整数的序列,每个数不超过5000,对它们两两相加得到的N*(N-1)/2个和,求出其中前M大的数(M<=1000)并按从大到小的顺序排列。 Input 输入可能包含多组数据,其中每组数据包括两行: 第一行两个数...
hash
2019-08-25
0
432
PAT (Advanced Level) Practice 1048 Find Coins(hash)
1048 Find Coins (25 分) Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal...
hash
2019-08-24
0
452
PAT (Advanced Level) Practice 1078 Hashing(hash)
1078 Hashing (25 分) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions o...
哈希
2019-08-24
0
461
HDUOJ 2018 母牛的故事(动态规划入门)
得出简单的计算公式后便可直接算出了 solution: #include <bits/stdc++.h> using namespace std; int dp[60]; int f(int n) { if (dp[n])return dp[n]; return dp[n] =...
动态规划
2019-08-23
0
510
斯特林公式(数论)
斯特林公式
数论
2019-08-22
0
593
HDUOJ 1018 Big Number(数论)
solution:这个题目大意是求一个数的阶乘的位数,咱们很容易想到一个数的位数为(int)log10(n) + 1,故数n的阶乘的位数为(int)log10(1 * 2 * 3 * … * n) + 1 #include <bits/stdc++.h> using namespace...
数论
2019-08-22
0
502
HDUOJ 1010 Tempter of the Bone (深搜+奇偶减枝)
solution:原本以为是简单的迷宫上深搜,但是将各种常规减枝都剪除了之后仍然超时,很是恼火,百度了一下发现还有奇偶减枝这个东西,果然加了奇偶减枝就过了,不明白奇偶减枝的看这个链接 #include <bits/stdc++.h> using namespace std; int ...
深搜
奇偶减枝
2019-08-22
0
403
奇偶减枝(深搜小技巧)
奇偶减枝: 在一个地图中,若终点(ex,ey)和起点(sx, sy)满足t-abs(ex-sx)-abs(ey-sy)不为偶数,则无法恰好在t步内恰好到达;
奇偶减枝
深搜
2019-08-22
0
378
HDUOJ 1518 Square(深搜)
solution:经典的深搜思路; 先判断行不通的情况: 1、棍子总长不是4的倍数必然不能组成正方形 2、最长棍的长度的四倍大于棍子总长必然不能组成正方形 再一条边一条边地进行搜索 #include <bits/stdc++.h> using namespace std; int n...
深搜
2019-08-22
0
431
首页
上一页
1
2
3
4
下一页
末页