自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

KeyboardPianist的博客

有一天,我会足够强大,足够勇敢。

  • 博客(18)
  • 问答 (3)
  • 收藏
  • 关注

原创 HDU 5305 Friends DFS+剪枝

题意:n个人,m对朋友,每一对朋友可以是online friend或者offline friends,m对朋友不重复,每个人的两种朋友数量必须相等,问有多少种方法满足要求方法:注意:朋友的朋友和自己没有关系,用DFS回溯+剪枝,测试每对朋友为online friend和offline friends的情况,当任一个人的朋友数为奇数时候可以直接输出0因为分配不            了,

2015-08-27 22:46:32 461

原创 HDU 5289 Assignment

题意:问一个序列中有多少个子序列,其最大值与最小值的差小于k方法:用单调队列解,用两个deque,q1单调递增,q2单调递减#include #include #define maxn 100005using namespace std;int a[maxn];int f(int n){ return (n + n * (n - 1) / 2);}int main(

2015-08-27 22:30:35 368

原创 HDU 5349 MZL's simple problem 优先队列

说的很好的三种做法:点击打开链接#include #include #define min -1000000000using namespace std;int main(){ int n, op, max, x; priority_queue q; max = min; while(scanf("%d", &n) != EOF) {

2015-08-25 23:07:34 350

原创 HDU 5317 RGCDQ

题意:求maxGCD(F[i], F[j])(L 思路:先用筛法求出所有质数,然后求出它们的F[x], 最后求区间内的GCD(用到前缀和),F[x]最多有7种质因子,因为2 * 3 * 5 * 7 * 11 * 13  * 17 = 510510(再增加就超出题目给的数据范围)#include #include #include #define maxn 1000005us

2015-08-23 15:08:16 315

原创 HDU 5238 Problem Killer

#include #define maxn 1000010int max(int a, int b){ return a>b?a:b;}double a[maxn], d[maxn], q[maxn];int main(){ int t, n, i, res, ap, gp; scanf("%d", &t); while(t--) {

2015-08-21 22:56:28 401

原创 HDU 5344 MZL's xor

题意:刚开始并没看懂,发现样例的结果是自己的结果的两倍,所以乘2,用long long int就过了#include #define maxn 500010long long int A[maxn];int main(){ int n, m, z, l, t, i; long long int ans; scanf("%d", &t); while(t-

2015-08-20 19:08:26 352

原创 HDU 5387 Clock

题意:给出24小时制的时分秒,让你输出时针和分针、时针和秒针、秒针和分针的角度(分式)思路:注意一下当时间超过12点的时候时针已经转了一圈了#include #include #define ll long long intstruct node{ ll ra;//分子 ll na;//分母};ll gcd(ll a, ll b){ if(b

2015-08-19 21:41:05 387

原创 HDU 5389 Zero Escape

题意:给出A, B两个值, 再给出n个数,问n个数分成2组,使其中一组的数字根为A,另一组数字根为B,或者所有数的数字根为A或B的方法有多少种。           数字根题目有说,还可以直接把数加起来然后模9得到。思路:dp[i][j]表示前i个数中,组成的数字根值为j的方法有多少种           状态转移:dp[i][j] = (dp[i][j] + dp[i - 1][

2015-08-19 21:37:14 336

原创 HUD 5375 Gray code 动态规划

当i这个位置填0时能获取的最大值

2015-08-17 22:26:23 396

原创 HDU 5360 Hiking 优先队列

题意:beta想要请n个soda去远足,邀请第i个soda时要符合一个条件:当前人数不少于li并且不大于ri(如果满足就同意,即使后来的人数会不符合现在提出的条件),问最多可以邀请多少个soda,输出数目和邀请顺序(若有多种方法输出任一个即可)思路:将soda按照l的值从小到大排列(如果soda【0】!= 0则能邀请的人数为0),每次将符合当前条件的soda(l值不大于当前已参加的人数

2015-08-16 16:01:23 368

原创 HDU 2095 find your present (2)

用set水了一下 #include #include using namespace std;int main(){ int n, i, x; while(scanf("%d", &n)&&n != 0){ sets1; for(i = 0;i < n;i++){ scanf("%d", &x); if(s1.insert(x).seco

2015-08-14 16:58:56 270

原创 HDU 4750 Count The Pairs

#include #include #include #define maxn 500010using namespace std;int par[10010], rank1[10010], a[maxn], b[maxn];long long int sum[maxn];void init(int n){ for(int i = 0;i < n;i++){

2015-08-12 14:05:57 309

原创 HDU 4740 The Donkey of Gui Zhou

模拟即可,不能走各自已经走过的路,不能转两次弯 #include #include #include #define maxn 1005using namespace std;struct node{ int x, y, flag, Time, isMove;};node dk, t;bool vis[maxn][maxn][2];int dx[

2015-08-11 11:00:37 439

原创 poj 2774

最长公共子串 #include #include #include #include #define maxn 100010 * 2using namespace std;int n, k;int rank[maxn];int tmp[maxn];int sa[maxn], lcp[maxn];string S,T;bool compara_sa

2015-08-10 13:32:42 314

原创 poj 1195

二维树状数组:http://www.java3z.com/cwbwebhome/article/article1/1369.html?id=4804 #include #include #define maxn 1035int C[maxn][maxn];int S;int lowbit(int t){ return t&(-t);}int Sum(int

2015-08-10 11:30:02 524

原创 HDU 4739

题意:有很多石子,要四个四个的消去,而且这四个点要构成一个正方形,为了方便题目规定正方形的边平行于坐标轴,要注意可能有重复的点思路:取出所有符合要求的正方形,用状态压缩记录每个正方形的状态,枚举每个正方形。#include #include #include #include using namespace std;struct node{ int x;

2015-08-09 16:04:38 443

原创 HDU 4734

题意:给出a, b两个数, 求0到b不大于f(a)的数的个数, F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 * 1. An表示a对于位上的值用数位DP,这里讲的比较详细http://www.cnblogs.com/Griselda/archive/2013/11/20/3433295.html#include

2015-08-09 15:08:17 470

原创 HDU 4741

求两条异面直线的距离、与公垂线的交点坐标先①作直线a、b的方向向量a、b,求a、b的法向量n,即此异面直线a、b的公垂线的方向向量;②在直线a、b上各取一点A、B,作向量AB;③求向量AB在向量n上的射影d,则异面直线a、b间的距离为再http://blog.sina.com.cn/s/blog_648868460100h1sf.html 套入公式 #inc

2015-08-08 11:08:32 443

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除