自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU 2896病毒侵袭

#include #include#includeusing namespace std;typedef  struct  trie{    struct   trie  *fail;    struct   trie  *next[130];    int  count;trie(){fail=NULL;count=0;memset(next,

2013-05-15 12:18:45 388

转载 【完全版】线段树[转]

【完全版】线段树很早前写的那篇线段树专辑至今一直是本博客阅读点击量最大的一片文章,当时觉得挺自豪的,还去pku打广告,但是现在我自己都不太好意思去看那篇文章了,觉得当时的代码风格实在是太丑了,很多线段树的初学者可能就是看着这篇文章来练习的,如果不小心被我培养出了这么糟糕的风格,实在是过意不去,正好过几天又要给集训队讲解线段树,所以决定把这些题目重新写一遍,顺便把近年我接触到的一些新题更

2013-05-09 06:45:41 330

原创 HDU 2222 (AC自动机)

#include #include#include#includeusing namespace std; typedef  struct   node {     struct   node  *fail;     struct   node   *next[26];     int  count; }node ; node   *Q[

2013-05-08 08:45:25 312

原创 ZOJ 2639 01背包

求第K优解#include#include#includeusing namespace std;int main(){    int  t,n,v,k,K;    int  f[1010][35];    int  value[110],volum[110];    int   a[35],b[35];    int   x,y,z;

2013-04-30 11:05:05 389

原创 HDU 2602

简单的0 1背包。。。#include#include#includeusing namespace std;#define    N     1010int  max(int a,int b){    return a>b?a:b;}int main(){    int t;    int  value[N],volum[N];

2013-04-29 18:56:57 322

原创 ZOJ 1666 Square Coins

完全背包求方案总数。。。一直不对,看了结题报告才恍然大悟,因为费用和背包的大小 都是有限的,知道范围的,所以可以先进行预处理。。。#include #include#include#includeusing namespace std;int main(){    int  f[301];    int  c[290];    int  n;

2013-04-27 21:25:44 366

原创 HDU 2546

水题   WA了好多次 ,先判断小于五是直接输出,然后用continue继续循环,用break了,WA了好多次。。。。再将总的余额减5然后01背包。#include #include#includeusing namespace std;int  cmax(int a,int b){    return a>b?a:b;}int main(){    i

2013-04-26 21:52:05 415

原创 ZOJ 2224( 完全背包)

不说啥了,就是完全背包,但是是大数据,所以在数组申请上有一个小处理,因为背包的容量在最后并不影响所得的价值,所以将的容量除以1000就大大减小了数据。。。#include #includeusing namespace std;#define NUM 11#define T  10000int  max(int a,int b){    return

2013-04-26 20:31:53 424

原创 2012-12-08 11:25 ZOJ1205

交了好多次,终于A了 水题。。。。。#include#include#includeusing namespace std;char table[20]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j'};int sua(char s){int j;f

2013-04-16 21:55:02 353

转载 字符数组赋值

举例如下:char a[10];1、定义的时候直接用字符串赋值char a[10]="hello";注意:不能先定义再给它赋值,如char a[10];a[10]="hello";这样是错误的!2、对数组中字符逐个赋值char a[10]={'h','e','l','l','o'};3、利用strcpychar a[10];strcpy(a, "he

2013-04-16 21:53:30 428

原创 ZOJ1201

水题。。一次就A了 两个子函数,当输入序列时,从序列后面往前遍历,找他后面比他大的数的个数,然后用总数减掉这个数,和比他大的个数,放入对应的数组中,另一个子函数从前面遍历#include#includeusing namespace std;int P[55],I[55];void per(int n){int i,j,sum;for(i=n;i>0;i

2013-04-16 21:51:52 424

原创 HDU 2087 剪花布条

#include#includeusing namespace std;int main(){string s1,s2;int pos;while(cin>>s1){if(s1=="#")break;cin>>s2;pos=0;pos=s1.find(s2);if(pos==-1) printf("0\n");else{int

2013-04-16 21:38:38 306

空空如也

空空如也

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

TA关注的人

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