Problem Description As one of the most powerful brushes, zhx is required to give his juniors n problems. zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautiful way. zhx defines a sequence {ai} beautiful if the…
zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 448    Accepted Submission(s): 147 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n p…
传送门 zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 575    Accepted Submission(s): 181 Problem Description As one of the most powerful brushes, zhx is required to give his juniors…
题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5187 bc(中文): http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=571&pid=1002 题解: 求(2^n-2)%p,题目看错,一天都没什么思路,冷静一下.. 代码: #include<iostream> #include<cstring> #include<cst…
zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3835    Accepted Submission(s): 1255 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n…
作为史上最强的刷子之一,zhx的老师让他给学弟(mei)们出n道题.zhx认为第i道题的难度就是i.他想要让这些题目排列起来很漂亮. zhx认为一个漂亮的序列{ai}下列两个条件均需满足. 1:a1..ai是单调递减或者单调递增的. 2:ai..an是单调递减或者单调递增的. 他想你告诉他有多少种排列是漂亮的.因为答案很大,所以只需要输出答案模p之后的值. Input Multiply test cases(less than 10001000). Seek EOF as the end of…
题目分析如果n=1,答案是1,否则答案是2n−2. 证明:ai肯定是最小的或者最大的.考虑另外的数,如果它们的位置定了的话,那么整个序列是唯一的. 那么ai是最小或者最大分别有2n−1种情况,而整个序列单调增或者单调减的情况被算了2次,所以要减2. 要注意的一点是因为p>231,所以要用快速乘法.用法与快速幂相同.如果直接乘会超过long long范围,从而wa掉. 快速幂+快速乘法 #include<cstdio>#include<cstring>#include<c…
zhx's submissions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 540    Accepted Submission(s): 146 Problem Description As one of the most powerful brushes, zhx submits a lot of code on many o…
Problem Description As one of the most powerful brushes, zhx submits a lot of code on many oj and most of them got AC. One day, zhx wants to count how many submissions he made on n ojs. He knows that on the ith oj, he made ai submissions. And what yo…
主题链接: http://acm.hdu.edu.cn/showproblem.php?pid=5187 题意: 从1~n,有多少种排列 使得 a1~ai 满足单调递增或者单调递减. ai~an 满足单调递增或者递减. 非常明显的组合问题 从n个数种选出i个数 剩下的数要满足单调递增或者递减或者递减的规律那么方式唯一 ans = (C(N,0)+C(N,1)+......+C(N,N)) =2^N; 可是这样的情况下 单调递增和单调递减算了两遍  因此要减2 ans = 2^n - 2; 注意n…
http://acm.hdu.edu.cn/showproblem.php?pid=5187 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n problems. zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautiful wa…
传送门 zhx and contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 145    Accepted Submission(s): 49 Problem Description As one of the most powerful brushes in the world, zhx usually takes part…
Problem Description As one of the most powerful brushes in the world, zhx usually takes part in all kinds of contests. One day, zhx takes part in an contest. He found the contest very easy for him. There are n problems in the contest. He knows that h…
题链:http://acm.hdu.edu.cn/showproblem.php?pid=5282 Senior's String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 142    Accepted Submission(s): 40 Problem Description Xuejiejie loves strings m…
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=3177 Problem Description Crixalis - Sand King used to be a giant scorpion(蝎子) in the deserts of Kalimdor. Though he's a guardian of Lich King now, he keeps the living habit of a scorpion like living und…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4864 Task Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1035    Accepted Submission(s): 245 Problem Description Today the company has m tasks to…
http://acm.hdu.edu.cn/showproblem.php? pid=4865 大致题意:有三种天气和四种叶子状态.给出两个表,各自是每种天气下叶子呈现状态的概率和今天天气对明天天气的概率. 给出n天叶子的状态.输出最有可能的天气序列. 思路:wl[i][j]表示天气为i,叶子为j的概率,ww[i][j]表示今天天气为i明天天气为j的概率,st[i]表示第一天天气为i的概率. 对于叶子序列{a1,a2......an},存在一个天气序列{b1,b2......bn},那么总的概率…
zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1867    Accepted Submission(s): 596 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n p…
点击打开链接 Alice's Print Service Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1084    Accepted Submission(s): 240 Problem Description Alice is providing print service, while the pricing doesn't…
Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2390    Accepted Submission(s): 578 Problem Description Teacher Mai has a kingdom with the infinite area. He has n students guard…
http://acm.hdu.edu.cn/showproblem.php?pid=5755 题意:一个N*M的矩阵,改变一个格子,本身+2,四周+1.同时mod 3;问操作多少次,矩阵变为全0.输出次数和具体位置 由于影响是相互的,所以增广矩阵的系数a[t][t+1] 或者是 a[t+1][t]均可:只需注意往结果中添加位置时,x[i]表示要操作x[i]次,所以位置要重复添加x[i]次: 高斯消元时间复杂度为O(N3M3); #pragma comment(linker, "/STACK:10…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5738 题意:从n(n <= 1000)个点(有重点)中选出m(m > 1)个点(选出的点只看标号,不看具体坐标)合成一个集合,问集合中的点共线(可以重合)的集合个数? 思路:按照x,y双关键字排序,之后对每一个点求出所有以它为一个端点的线段个数: 及时计数:要求以当前点为端点的线段数,分成两种情况: 1. 线段就为当前点,即将当前点的重点合成一个点,C(n,2)+C(n,3)+...+C(n,n)…
考试时,想到了一个很类似的方法,但是总是差那么点,就是这么点,需要不断的努力啊!!! 题解: 基本思想是贪心. 对于价值c=500*xi+2*yi,yi最大影响100*2<500,所以就是求xi总和最大.可以先对机器和任务的时间从大到小排序.从最大时间的任务开始,找出满足任务时间要求的所有机器,从中找出等级最低且满足任务等级要求的机器匹配.依次对任务寻找满足要求的机器. 这几乎是把标程复制了一遍,因为其中的STL用的实在巧妙而且准确,自己写的话确实搞不出来. #include <cstdio&…
题意: 给一个字符x代表真实的a 然后输出的时候转换 然后就是求最长回文子串的串是什么 长度要大于1 思路: 就是裸的manacher,弄清楚下标的转换关系就好了 代码: #include"cstdlib" #include"cstdio" #include"cstring" #include"cmath" #include"queue" #include"algorithm" #inc…
pid=3966" target="_blank" style="">题目链接:hdu 3966 Aragorn's Story 题目大意:给定一个棵树,然后三种操作 Q x:查询节点x的值 I x y w:节点x到y这条路径上全部节点的值添加w D x y w:节点x到y这条路径上全部节点的值降低w 解题思路:树链剖分,用树状数组维护每一个节点的值. #pragma comment(linker, "/STACK:1024000000,1…
Senior's Gun Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 616    Accepted Submission(s): 241 Problem Description Xuejiejie is a beautiful and charming sharpshooter. She often carries n guns,…
HDU Aragorn's Story 题目链接 树抛入门裸题,这题是区间改动单点查询,于是套树状数组就OK了 代码: #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; const int N = 50005; inline int lowbit(int x) {return x&(-x);} int dep…
Andrew Stankevich's Contest (1) 打一半出门了,回来才补完了...各种大数又不能上java..也是蛋疼无比 A:依据置换循环节非常easy得出要gcd(x, n) = 1而且x <= n / 2,那么把相应几种情况的最大值考虑一下就可以,各自是n % 2 = 1为n / 2, n % 4 = 0为n / 2 - 1,n % 4 = 2为n / 2 - 2 B:限制下限的最大流,建模方法为原来容量变成c - l,然后源点连到每一个点的下限和为正,每一个点下限和为负连到…
职务地址:HDU 2120 这题尽管字数不多,但就是看不懂. . 意思是求最多有多少个被墙围起来的区域.显然就是求环的个数.然后用并查集求环个数就能够了. 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h…
职务地址:HDU 3729 二分图最大匹配+按字典序输出结果. 仅仅要从数字大的開始匹配就能够保证字典序最大了.群里有人问. . 就顺手写了这题. . 代码例如以下: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int vis[110000], head[110000], cnt, link[110000]…