自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(179)
  • 问答 (1)
  • 收藏
  • 关注

原创 poj 1961 Period

#include #include #include #include using namespace std; char str[1000010]; int *Next; int n; void findNext(char *p){ if(Next != NULL){ delete[]Next; } Next = new int [n+1]; int i = 3, k; Next

2013-09-04 21:22:38 631

转载 C语言中static的作用(来自博客园)

static作用(修饰函数、局部变量、全局变量) 在C语言中,static的字面意思很容易把我们导入歧途,其实它的作用有三条。 (1)先来介绍它的第一条也是最重要的一条:隐藏。 当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性。为理解这句话,我举例来说明。我们要同时编译两个源文件,一个是a.c,另一个是main.c。 下面是a.c的内容 char a

2013-07-26 15:56:32 632

转载 poj 1723Soldiers 带全中位数

#include #include using namespace std; int N,x[10000],y[10000],rx,ry,t,sum; int main(){ cin>>N; for(int i=0;i<N;i++){ cin>>x[i]>>y[i]; } sort(y,y+N); ry=y[N/2]; sort(x,x+N); for(int i=0;i<

2013-07-21 14:36:02 640

原创 poj 1694 An old stone game

#include #include #include #include #include #include using namespace std; class node{ public: int mx; //到达此节点所调动的最少石子数 //int cur; //到达此节点时实际占用的节点数 int num; //子节点的数目 int*child; //子节点编号 }; node

2013-07-19 08:11:30 703

转载 memset的效率(转自百度空间-这不是我的世界)

memset的效率问题 今天在CSDN上有人聊memset的效率。凑巧,我这几天也看了看glibc的几个函数的实现。 下面就扯一扯DIR/string/memset.c 其中DIR是解压glibc后的路径。我下载的是glibc-2.11。 //代码经过astyle格式化 void * memset (dstpp, c, len) void *dstpp; int c; siz

2013-07-15 22:17:39 893

原创 poj 2250 Compromise(动归)

#include #include #include #include #include #include #include using namespace std; vector p1, p2; vector p[105][105]; char sample[35]; string word; int numOfMark = 1; void deal(); int main(){ freop

2013-07-11 16:40:24 664

原创 poj 1042Gone Fishing

//Memory 256kB Time 0ms 代码长度:1955B  #include #include #include #include #include using namespace std; int n,h; struct lake{ int f; int d; }; int t[27]; lake l[27]; lake ll[27]; int tt[27]; int be

2013-07-11 15:48:20 618

原创 poj 1054Annoying frog(枚举)

#include #include #include #include #include using namespace std; int r,c,n; struct plant{ int x; int y; }; bool operator<(const plant& a,const plant&b){ if(a.x == b.x) return a.y < b.y; return

2013-06-27 10:02:53 581

原创 poj 2745显示器(模拟)

#include #include #include #include #include #include using namespace std; int s, n,len; int number[10]; void trans(int num){ if(num == 0){ number[1] = 0; len = 1; return ; } len = log10((do

2013-06-26 21:43:56 1108

原创 poj 1384 piggy-bank

#include #include #include #include #include using namespace std; const int MAX = 0x6fffffff; int t,e,f,n,net, m; struct coin{ int p; int w; }; int c[10010]; int main(){ // freopen("1.txt","r",stdi

2013-06-26 11:57:19 665

原创 poj 2063Investment

#include #include #include #include #include using namespace std; int t; int init,year, d; struct stock{ int v; int p; }; stock s[15]; int f[45300]; int main(){ //freopen("1.txt","r",stdin); int

2013-06-26 11:21:54 693

原创 poj 1276CashMachine多重背包

#include #include #include #include #include using namespace std; int cash,kind; struct money{ int d; int n; }; money t[15]; bool flag[100001]; int cnt[100001]; int main(){ //freopen("1.txt","r",s

2013-06-26 08:38:57 584

转载 poj 1742 多重背包、数组标记法

#include #include #include using namespace std; #define CLR(arr,val) memset(arr,val,sizeof(arr)) const int N = 100010; int num[110]; bool flag[N]; int cnt[N]; int main(){

2013-06-25 21:59:27 658

原创 poj 1828 Monkey's Pride

#include #include #include #include using namespace std; int n; struct a{ int x,y; }; bool operator < (const a & c,const a& b){ if(c.x == b.x) return c.y < b.y; return c.x < b.x; } a monkey[5

2013-06-25 21:50:53 723

原创 poj 木棒

#include #include #include #include #include #include using namespace std; int total, mx,sum; int sticks[100]; bool used[100]; bool dfs(int tobuild, int localleft, int totalleft,int tr){ //tobuild表示尝

2013-06-24 15:29:26 843

原创 poj 跳格问题

#include #include #include #include #include using namespace std; /*棋子在起点时,可向前移动一个格子到第二个方格内;棋子在其他方格内时,可根据方格内的数字Ni进行移动。如果Ni大于零,就向前移动Ni个格子; 如果Ni小于零,就向后移动-Ni个格子;如果Ni等于零,则此次原地不动一次,在下一步移动时可向前移动一步到下一个格子。 显

2013-06-24 15:27:54 690

原创 poj3709 2进制转化为3进制

#include #include #include #include using namespace std; unsigned long long base = 1; int main(){ //freopen("1.txt","r",stdin); int n,length; unsigned long long digit = 0; char str[100]; char

2013-06-21 18:09:10 932 3

原创 poj 1061青蛙的约会(扩展欧几里得)

#include #include #include using namespace std; int common; int ex_gcd(int a,int b, int &x ,int &y){ if(b == 0){ x = 1; y = 0; return a; } int d = ex_gcd(b,a % b,x,y); int temp = x; x =

2013-06-10 11:59:39 669

转载 poj divisibility

// 背包问题 #include #include int dp[10001][101]; int n, m; int a[10001]; int main() { int i, j, k, tmp; while (scanf ("%d%d", &n, &m) != EOF) { for (i = 1; i <= n; i++) { scanf ("%d", &a[i]

2013-06-07 12:58:02 601

空空如也

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

TA关注的人

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