自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

imut zcy,I promise You.

C Y 默 默 前 行 !

  • 博客(152)
  • 资源 (2)
  • 收藏
  • 关注

原创 HDU 5171 GTY's birthday gift

#include #include #include #include #include using namespace std; #define LL long long struct Mat{ LL f[3][3]; }; LL MOD = 10000007; int a[100010]; Mat mul(Mat a,Mat b) { LL i,j,k;

2015-02-13 12:06:54 512

原创 BestCoder #29 GTY's math problem

#include #include #include #include #include #define eps 1e-8 using namespace std; int main() { int a,b,c,d; while(~scanf("%d%d%d%d",&a,&b,&c,&d)) { double num1=b*log(a); double num2=d*l

2015-02-13 09:42:55 408

原创 POJ 1458 Common Subsequence

题意:求LCS Sol:经典的 LCS。 if ( i==0  || j==0 )  dp [ i , j ] = 0 ; else if ( X[ i ] == Y [  j ] ) dp [ i-1 , j-1 ] + 1; else dp [ i, j ] = max  (  dp[ i - 1 , j ] , dp [ i ,  j-1 ] )  #include #i

2014-10-18 20:48:12 669

原创 POJ 2479 Maximum sum

题意:给你一个数列,求出数列中不相交的两个子段和,要求和最大。 Sol:对于每个i来说,求出 [ 0 ~ i-1 ] 的最大子段和以及 [ i ~ n-1 ] 的最大子段和,在加起来,求一个最大的就可以了。 [ 0 ~ i-1 ] 的最大子段和从左向右扫描 , [ i ~ n-1 ] 从右向左扫描。 复杂度O(n) #include #include using namespace

2014-10-18 20:34:34 700

原创 线性动态规划——专题

定义: 线性DP问题的子状态与父状态之间往往相差一个元素,所以子状态通过添加一个增量而转换到父状态。从最小的子问题到原问题,一层一层的状态转移呈现出线性递增的关系,所以称为线性DP。 经典的线性DP问题有最大字段和、最长公共子序列、最长回文子序列、最长不下降(下降)子序列等等。。。 大部分的线性DP都是1维的。 陆续更新线性DP的题。

2014-10-16 12:36:44 1470

原创 回归ACM

之前有很多烦躁的事,现在好了终于可以在为自己的大学生活在拼一次!

2014-10-16 12:16:53 417 1

原创 POJ 2142 The Balance

SOL : 扩展的欧几里德,  ax+by==c   x=x0+b/d*t; y=y0-a/d*t; 求|x|+|Y|的最小值 可以发现: |x0+b/d*t| 单调递增      |y0-a/d*t| 单调递减  因为 a>b,所以就是说函数是凹的,先减小后增大。 显然  当y0-a/d*t==0的时候  |x|+|Y| 最小值就在那附近。 枚举几个值就能找到。 #in

2014-05-20 21:31:01 619

原创 HRBUST 1328 相等的最小公倍数

SOl:将原题改为枚举N的每一对因子,计算其是否互素即可。 #include #include #include using namespace std; inline int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int n,T,i,j; scanf("%d",&T); while(T

2014-05-20 20:54:23 711

原创 POJ 3070 Fibonacci

Sol:就是求第N项的斐波那契数。矩阵乘法+快速幂 #include #include #include #include using namespace std; #define LL long long struct Mat{ LL f[2][2]; }; LL MOD = 10000; Mat mul(Mat a,Mat b) { LL i,j,k

2014-05-18 20:34:24 538

原创 ZOJ 3213 Beautiful Meadow

求简单路径。得到最大的分数。 用最小表示法,需要增加标志位记录独立插头个数。要使独立插头个数小于等于2.

2014-05-13 15:51:26 524

原创 ZOJ 3256 Tour in the Castle

求环路的个数,按照列来DP转移。 由于M比较大所以需要矩阵乘法+

2014-05-13 15:46:19 439

原创 ZOJ 3466 The Hive II

正六边形形成的格子的单回路数。 与

2014-05-13 15:32:19 474

原创 POJ 3133 Manhattan Wiring

将格子中的两个2和两个3连起来,求

2014-05-13 15:24:45 499

原创 POJ 1739 Tony's Tour

从左上角到右下角,每个非障碍格子都得走一遍的方法数。

2014-05-13 15:15:03 494

原创 FZU 1977 Pandora adventure

单回路数,有三种格子, 1.必须走 2.可以走 3.不可以走 求回路数

2014-05-13 15:08:18 482

原创 URAL 1519 Formula 1

插头DP。单回路,求回路数。

2014-05-13 15:01:44 404

原创 HDU 4285 circuits

插头DP。 题目要求构造出K条回路的方案数,而且不能出现环套环。 Sol:通过增加标记为来记录形成的回路数,假如不形成环的话就是在形成新的环路,此时,两边的插头个数要为偶数。 #include #include #include #include using namespace std; const int MAXD=15; const int STATE=1000010; const i

2014-05-13 14:51:24 990

原创 HDU 3377 Plan

插头DP。 从左上角到右下角,每个格子都有Val,每个格子只能经过一次,可以不经过,求最大的分数之和。 #include #include #include #include using namespace std; const int MAXD=15; const int HASH=10007; const int STATE=1000010; int N,M; int maz

2014-05-13 14:42:49 778

原创 HDU 1964 Pipes

插头DP。 每个格子之间的墙壁有一个花费,求用一个环经过每个格子一次

2014-05-13 14:36:50 383

原创 HDU 1693 Eat the Trees

插头DP,多条回路求回路数。 可以当作模版来记。注重理解轮廓线。 #include #include #include #include using namespace std; const int HASH=10007; const int STATE=5000; //状态数 const int MAXD=15; int code[MAXD],maze[MAXD][MAXD];

2014-05-13 14:22:59 728

原创 跟着Kuangbin学插头DP

看完了Bin个推荐的Blog和论文,再结合Bin

2014-05-13 14:13:09 567

原创 HDU 4572 Bottles Arrangement

详细的证明:点击打开链接 我的想法: 要想保证题目所说 构造最小行的和,只能是这种情况 .....      m-3  m-2  m-1  m    |   m  m-1  m-2  m-3    . ....  所以Ans 也就是取前N项就可。 又因为 It is guaranteed that N is always odd。  显然构造没问题。 #include #in

2014-05-13 13:52:12 724

原创 HDU 4565 So Easy!

线性推,矩阵乘法+快速幂求通项。 传送门:点击打开链接 #include #include #include #include using namespace std; #define LL long long struct Mat{ LL f[2][2]; }; LL MOD; Mat mul(Mat a,Mat b) { LL i,j,k;

2014-05-13 13:45:29 735

原创 BNU 33960 The table

其实就是签到题。。高精度,就是让你求一个矩阵哪一列的乘积和最大,输出该列的列号,如果乘积相同则输出最大的列号。 import java.util.Scanner; import java.math.*; public class Main { static final int maxn = 1000 + 10; static final int maxm = 25 + 10; stati

2014-05-11 15:31:14 677

原创 XDU 1284 寻找礼物

枚举+二分查找。 A+B+C >= K  ---->   C >= K - A -B    ----> 统计大于等于C的个数即可。  #include #include #include #include #include #include using namespace std; int a[1010]; int Scan() //输入外挂 { int

2014-05-06 14:04:26 700

原创 URAL 1549 Another Japanese Puzzle

Sol :构造题。 因为要求路线闭合,那么转弯的数量 T 必须大于等于 4,否则无解。 猜想下,只能用偶数个 S 和偶数个 T,不然不可能构成闭合路径。

2014-04-25 12:27:55 501

原创 Ural 1545 Hieroglyphs

Sol:字符串处理。对字符串排序即可,然后依次的输出就行了。

2014-04-24 12:49:32 406

原创 Ural 1550 Dean's Pyramid 3

Sol:V-ans  = V-正四面体  -  V-截住

2014-04-24 12:47:36 433

原创 Ural 1551 Sumo Tournament

题意:要你求最大的比赛轮次

2014-04-24 12:44:29 470

原创 2014 Multi-University Joint Training Round Beta

DAY 1:第一次很认真的做了这么一套题,发现智商拙计

2014-04-24 12:38:08 491

原创 BZOJ 2301

分段优化即可。继续学习中。

2014-04-22 21:50:21 459

原创 HDU 1695 GCD

容斥+欧拉函数。。。

2014-04-22 21:47:49 384

原创 HDU 1695 GCD

学习Moblus之路。。。稍微有了一点感觉 学习资料: http://www.cnblogs.com/zhsl/p/3269288.html http://wenku.baidu.com/view/fbe263d384254b35eefd34eb.html #include #include #include #include #include #include

2014-04-22 21:44:59 543

原创 HDU 1286 找新朋友

Sol:欧拉函数的应用。。。。 #include #include using namespace std; const int maxisp = 1000 + 10; const int maxp = 500 + 10; int num,n; int prime[maxp]; int isprime[maxisp]; inline v

2014-02-06 17:14:12 723

原创 HDU 2136 Largest prime factor

Sol:筛法求素数打表时预处理下即可。 #include #include using namespace std; const int maxisp = 1000000 + 10; const int maxp = 1000000 + 10; int num,n; int prime[maxp]; int isprime[maxisp]

2014-02-06 17:08:14 671

原创 HDU 1722 Cake

Sol:证明的好题。。。画个图就能推出来重复的次数就是GCD了。 #include #include #include using namespace std; inline int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int n,m; while(~scanf("%d%d",&n,&m))

2014-02-06 15:56:12 735

原创 HDU 1713 相遇周期

Sol:求分数的GCD小学生都会。。。注意通分约分就好。 #include #include #include using namespace std; inline long long gcd(long long a,long long b) { return b==0?a:gcd(b,a%b); } inline long long lcm(long long a,long l

2014-02-06 15:39:05 836

原创 HDU 2138 How many prime numbers

Sol: Miller素数即可解答。。。。 #include #include #include #include #include #include using namespace std; const int S = 8;//随即算法判定 long long mult_mod(long long a,long long

2014-02-05 17:28:58 618

原创 HDU 2029 Palindromes _easy version

Sol:一个数异或两次等于没操作。这题跟12年东北赛一题很像。。。 #include using namespace std; inline void scan(int &x) { char c; while(c=getchar(),c'9'); x=c-'0'; while(c=getchar(),c>='0'&&c<='9') x

2014-02-05 17:00:36 670

原创 HRBUST 2024 Strange fuction || HDU 2899 Strange fuction

Sol:求函数的最小值。求两次导数,判断函数的单调性和凹凸性即可,用二分查找即可。 #include #include using namespace std; const double eps = 1e-10; int T; double y; double G(double x) { return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+1

2014-02-03 22:15:00 676

2013年heu寒假集训练习赛AK--第4场

2013年heu寒假集训练习赛--第4场

2013-01-24

2013年heu寒假集训练习赛AK--第3场

2013年heu寒假集训练习赛--第3场

2013-01-23

空空如也

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

TA关注的人

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