自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(43)
  • 收藏
  • 关注

转载 android开发记录

13.5.141.自定义的view要放在xml里面使用,需要实现构造方法public Chessboard(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public Chessboard(Context con...

2013-05-14 20:35:00 77

转载 hdu 4217

线段树 1 #include<stdio.h> 2 #define MAXN 270000 3 int num[MAXN<<2]; 4 5 void build(int p,int l,int r) 6 { 7 num[p]=r-l+1; 8 if(l==r) 9 {10 re...

2013-05-06 23:00:00 72

转载 hdu1166

照着别人的线段树点修改打代码,一直runtime error到死,发现是那个最大值少了1个0 1 #include<stdio.h> 2 #include<string.h> 3 #define MAXN 50005 4 int sum[MAXN*10]; 5 6 void build(int l,int r,int p) 7 {...

2013-05-06 15:24:00 77

转载 hdu 1102

最小生成树1.prim适用于稠密图2.kruskal适用于稀疏图prim 1 #include<stdio.h> 2 #include<string.h> 3 const int MAXN=105; 4 int map[MAXN][MAXN]; 5 int v[MAXN]; 6 int main() 7 { 8 ...

2013-04-29 22:35:00 61

转载 hdu 1969

二分搜索,注意一下pi的精度就好 1 #include<stdio.h> 2 #include <math.h> 3 double area[10005]; 4 double pi=acos(-1.0); 5 int n,f; 6 7 int cut(double x) 8 { 9 int count=0;10...

2013-04-04 15:01:00 63

转载 hdu 2199

单调递增,二分搜索。。。 1 #include<stdio.h> 2 #define p2(x) ((x)*(x)) 3 #define p3(x) (p2(x)*(x)) 4 #define p4(x) (p2(x)*p2(x)) 5 6 double cal(double x) 7 {return 8*p4(x)+7*p3(x)+2*p2...

2013-04-03 12:04:00 57

转载 hdu 3310

用积分来做。。。。求出第一象限*8即可要注意积分的时候dx要取中间,不然过不了(看了别人博客才知道) 1 #include<stdio.h> 2 #include<math.h> 3 double cal(double r1,double r2,double dx) 4 { 5 return sqrt(r1*r1-dx*dx)*...

2013-03-31 15:32:00 75

转载 hdu 3033

状态转移方程dp[i][j]=max(dp[i-1][j-s[i][k].p]+s[i][k].v,dp[i][j-s[i][k].p]+s[i][k].v,dp[i][j]);表示第i组j块钱的状态转移,要么从第i-1组放第当前这个物品,要么从i组放当前物品,dp的初始值为-1,dp[0][0]=0.当dp[i][j]=-1表示不存在这个状态 1 #include &l...

2013-03-31 13:23:00 77

转载 hdu 2577

用open[],close[]记录每次决策后的最小敲击次数 1 #include<stdio.h> 2 #include<string.h> 3 int open[105]; 4 int close[105]; 5 int main() 6 { 7 int t; 8 scanf("%d",&t); 9...

2013-03-26 22:46:00 58

转载 hdu 2844

多重背包,二进制优化#include<stdio.h>#include<string.h>int dp[100005];int num[105];int v[105];int main(){ int n,m; while(~scanf("%d%d",&n,&m)) { ...

2013-03-26 22:25:00 59

转载 hdu 1789

贪心:首先把罚分降序排序,然后一个一个安排到deadline,如果那天已经被占,就安排到deadline前一天,如果前面都有安排了就直接扣分(参考了别人的博客) 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int mark[1005]; 5 st...

2013-03-26 18:29:00 58

转载 hdu 2569

递推 1 #include"stdio.h" 2 int main() 3 { 4 __int64 f[41]; 5 int T; 6 int n; 7 int i; 8 9 10 f[1]=3;11 f[2]=9;12 for(i=3;i<=40;i++) f[i]...

2013-03-21 21:23:00 66

转载 hdu 2955

01背包稍加修改 1 #include<stdio.h> 2 #include<string.h> 3 double max(double x,double y) 4 {return x>y?x:y;} 5 6 double dp[10005]; 7 double per[105]; 8 int mil[105]; ...

2013-03-19 14:57:00 71

转载 hdu 1541

第一道树状数组,树状数组下表由1开始 1 #include<stdio.h> 2 #include<string.h> 3 #define max 32050 4 int c[max],level[15010]; 5 6 int sum(int k) 7 { 8 int total=0; 9 while(k...

2013-03-18 18:45:00 83

转载 hdu 3336

kmp+dpdp[i]表示长度为i的前缀子串和dp[j]=dp[i]+1,next[j]=i因为在字符串p中,p[0...i]=p[j-i+1...j],也就是说p[0...i]在后面也出现了一次 1 #include<stdio.h> 2 #include<string.h> 3 char str[200005]; 4 int n...

2013-03-12 19:05:00 82

转载 hdu 1222

欧几里德扩展定理 1 #include <iostream> 2 using namespace std; 3 int gcd(int a,int b) 4 { 5 return !b?a:gcd(b,a%b); 6 } 7 int main() 8 { 9 int sum;10 cin>>sum...

2013-02-13 23:20:00 66

转载 hdu 1717

首先我们要明确,无限小数可按照小数部分是否循环分成两类:无限循环小数和无限不循环小数。无限不循环小数不能化分数,这在中学将会得到详尽的解释;无限循环小数是可以化成分数的。那么,无限循环小数又是如何化分数的呢?由于它的小数部分位数是无限的,显然不可能写成十分之几、百分之几、千分之几……的数。其实,循环小数化分数难就难在无限的小数位数。所以我就从这里入手,想办法“剪掉”无限循环小数的“大尾巴...

2013-02-01 17:33:00 76

转载 hdu 1286

欧拉函数 1 #include<stdio.h> 2 #include<cmath> 3 int num[37279]; 4 int eular(int n) 5 { 6 int ret=1,i; 7 for(i=2;i*i<=n;i++) 8 if(n%i==0) 9 ...

2013-02-01 17:21:00 64

转载 hdu 1050

实际上是求最大重叠区间,而最大重叠区间必定包括一个区间的端点为所有的区间端点附上权值,左端点为1,右端点为-1对于每一个端点设置一个值p=左边所有端点(包括自身)权值之和那么p值最大的端点为最大重叠区间包含的点,p为重叠层数 1 #include<stdio.h> 2 #include<stdlib.h> 3 struct node...

2013-01-29 10:15:00 98

转载 hdu 1052田忌赛马

贪心:贪心策略:1,如果田忌的最快马快于齐王的最快马,则两者比。(因为若是田忌的别的马很可能就赢不了了,所以两者比)2,如果田忌的最快马慢于齐王的最快马,则用田忌的最慢马和齐王的最快马比。(由于所有的马都赢不了齐王的最快马,所以用损失最小的,拿最慢的和他比)3,若相等,则比较田忌的最慢马和齐王的最慢马3.1,若田忌最慢马快于齐王最慢马,两者比。(田忌的最慢...

2013-01-28 23:10:00 123

转载 xml文件读写以及winform C#多线程

Rss源的xml读取1 XmlNodeList list = doc.GetElementsByTagName("item"); 2 foreach (XmlNode node in list) 3 {4 XmlElement ele = (XmlElement)node;5 string title = ele.GetElemen...

2012-12-26 19:23:00 234

转载 hdu1024

dp[i][j]表示前j个分组成i个组的最大和,状态转移方程为dp[i][j]=dp[i][j-1]+num[j]>dp[i-1][j-1]+num[j]?dp[i][j-1]+num[j]:dp[i-1][j-1]+num[j]表示:当前有2种状态,第j个数放进第i个组,或者是第j个数重新做第i组的第一个数(这时dp[i][j]等于这个数加上第i-1组j-1前最大的和),但是...

2012-11-28 21:14:00 59

转载 hdu 1159

最长公共子串 1 #include <stdio.h> 2 #include<string.h> 3 char x[2000],y[2000]; 4 int dp[2001][2001]; 5 int main(int argc, char *argv[]) 6 { 7 while (scanf("%s %s",x,y)!=...

2012-11-28 20:38:00 47

转载 hdu1072

广搜,遇到一次4就把它表为0,剩下时间为1时不要入队 1 #include <stdio.h> 2 #include<queue> 3 using namespace std; 4 int n,m; 5 int map[10][10]; 6 int sx,sy; 7 int dir[4][2]={{-1,0},{1,0},{0,1}...

2012-11-18 20:22:00 67

转载 hdu1026

广搜,碰到战斗直接往队列后面扔,打印路径递归实现 1 #include <stdio.h> 2 #include<string.h> 3 #include<queue> 4 using namespace std; 5 int n,m; 6 char map[105][105]; 7 int s[105][...

2012-11-18 20:17:00 69

转载 hdu 1180诡异的楼梯

bfs,又是一次血淋淋的教训,忽略了楼梯跳回起点的情况,wa了好几次,以后醒目了,标记步数的地图起点表为1,到后面步数-1就好了。这题是在普通bfs的基础上加了一点变化,在遇到楼梯的时候,用步数的奇偶性判断能不能过,如果能过,就看过了楼梯之后的那一格是否被访问过,如果没有就访问;如果楼梯不能过,把当前所在的位置步数+1放到队列尾(因此判断楼梯要在判断'.'后面,因为这样才能保证其他方...

2012-11-18 15:19:00 76

转载 poj 3278

题目http://poj.org/problem?id=3278基础广搜,打表就过了,最坏的情况就100000到1,一开始没注意题目有0,wa了,又一次因为没注意题目带来的血的教训 1 #include <stdio.h> 2 #include<string.h> 3 #include<queue> 4 using namesp...

2012-11-17 21:02:00 51

转载 C#获取一个html页面

1 public static bool getweb(string strURL, out string buf) 2 { 3 try 4 { 5 buf = ""; 6 HttpWebRequest httpReq; 7 ...

2012-11-16 15:27:00 81

转载 HDU 1176

免费馅饼,题目:http://acm.hdu.edu.cn/showproblem.php?pid=1176其实就是数塔,一开始没注意,从0秒开始做,相当于从数塔的顶端往下走,结果wa到荼蘼,后来从打后ac了 1 #include<stdio.h> 2 #include<string.h> 3 int dp[15][110000]; 4 i...

2012-11-15 14:33:00 56

转载 hdu 1253

胜利大逃亡,三维的广搜,其实就是增加2个方向 1 #include <stdio.h> 2 int a,b,c,t; 3 int map[51][51][51],mark[51][51][51]; 4 int dir[6][3]={{0,1,0},{0,-1,0},{0,0,1},{0,0,-1},{1,0,0},{-1,0,0}}; 5 struct...

2012-11-14 10:07:00 55

转载 sscanf

#include <stdio.h>#include<string.h>#include<algorithm>char a[2000];char b[2000];int num[2000];int main(int argc, char *argv[]){ while (scanf("%s",a)!...

2012-11-14 10:03:00 56

转载 hdu 1010

经典的深搜题目:http://acm.hdu.edu.cn/showproblem.php?pid=1010#include<stdio.h>#include<stdlib.h>char map[10][10];int n,m,t;int sx,sy,dx,dy;int found;int dir[4][2]={{-1,0},...

2012-11-11 21:18:00 58

转载 hdu 2612

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2612一开始犯2了,每个kfc搜索一次m和y,剪了也TLE,后来看到别人的解题,说广搜得出m和y的步数图,找加起来最小的kfc就可以了#include<stdio.h>int n,m;char map[300][300];int sm[300][300];i...

2012-11-11 21:15:00 47

转载 背包九讲(转载,大牛总结)

(牛人总结)背包九讲 收藏第一讲 01背包问题这是最基本的背包问题,每个物品最多只能放一次。第二讲 完全背包问题第二个基本的背包问题模型,每种物品可以放无限多次。第三讲 多重背包问题每种物品有一个固定的次数上限。第四讲 混合三种背包问题将前面三种简单的问题叠加成较复杂的问题。第五讲 二维费用的背包问题一个简单的常见扩展。第六讲 分组的背包问题一种题目类型,也是一个有用...

2012-11-04 11:11:00 54

转载 大整数模块

刘汝佳白书《算法竞赛经典入门》源码#include<cstdio>#include<string.h>#include<iostream>using namespace std;const int maxn = 1000;struct bign{ int len, s[maxn]; bign() { memset(s, 0, si...

2012-11-01 13:41:00 120

转载 大整数案例

输入不超过1000的正整数n,输出阶乘,用一位数组装结果(倒序)input 30output 265252859812191058636308480000000 1 #include<stdio.h> 2 #include<string.h> 3 const int MAX=3000; 4 int f[MAX]; 5 int mai...

2012-11-01 10:58:00 82

转载 系统软件开发文档编写指南

系统软件开发文档编写指南为帮助大家编写文档,这里列出了十三种文档的内容要求及其简要说明。这些文档包括:可行性研究报告,项目开发计划,需求规格说明书,概要设计说明书,详细设计说明书,用户操作手册,测试计划,测试报告,开发进度月报,项目开发总结报告,程序维护手册,软件问题报告和软件修改报告。各文档内容大纲由带编号的标题构成,标题后方括号内为其说明。这里给出一个统一的封面格式:...

2012-10-28 20:30:00 801

转载 苹果 盘子

Time Limit : 2000/1000ms (Java/Other)Memory Limit : 20000/10000K (Java/Other)Problem Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数...

2012-10-27 00:05:00 64

转载 (a,a+b)

Time Limit : 2000/1000ms (Java/Other)Memory Limit : 131072/65536K (Java/Other)Problem DescriptionBackgroundBinary trees are a common data structure in computer science. In this problem ...

2012-10-26 23:56:00 162

转载 poj1316

descriptionIn 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (Th...

2012-10-26 23:54:00 49

空空如也

空空如也

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

TA关注的人

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