自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

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

转载 结构和类的区别

结构与类的区别是它们在内存中的存储方式、访问方式(类是存储在堆【 heap,上的引用类型,而 结构是存储在栈fsak9上的值类型)和它们的一些特征(如结构不支持继豹 。较小的数据类型使用结 构可提高性能。但在语法上,结构与类非常相似,主要的区别是使用关键字siuct代替dass来声明 结构。

2014-10-28 10:33:47 208

原创 Linux网络编程---服务器端基本框架

/* 服务器 话机 :socket 绑定:bind 多路:listen 等待:accept 接通:新socket 总机等别的电话,分机跟客户通信 通信:write/read 挂断分机:close */ #include #include #include #include #include #include #include #include

2014-05-25 13:40:12 398

转载 sql server修改数据库的兼容级别

/* 语法 ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 }   参数 database_name 要修改的数据库的名称。 COMPATIBILITY_LEVEL { 80 | 90 | 100 } 要使数据库与之兼容的 SQL Server 版本。该值必须为下列值之一: = S

2014-05-23 13:19:09 758

转载 sql server 2008 通用表达式CTE

WITH TopSales (SalesPersonID,TerritoryID , NumberOfSales) AS ( SELECT SalesPersonID,TerritoryID, COUNT(*) FROM Sales.SalesOrderHeader GROUP BY SalesPersonID,TerritoryID ) SELECT * FROM TopSales W

2014-05-23 13:15:24 272

转载 linux常见同步方式互斥量Mutex的使用方法

1. 初始化: 在Linux下, 线程的互斥量数据类型是pthread_mutex_t. 在使用前, 要对它进行初始化: 对于静态分配的互斥量, 可以把它设置为PTHREAD_MUTEX_INITIALIZER, 或者调用pthread_mutex_init. 对于动态分配的互斥量, 在申请内存(malloc)之后, 通过pthread_mutex_init进行初始化, 并且在释放内存(fr

2014-05-21 21:00:20 290

原创 模拟daemon函数

#include #include #include #include #include #include int main() { pid_t pid ; pid = fork();//创建子进程 if(pid < 0) { perror("创建子进程失败"); return -1; } else if(pid > 0)//结束父进程 { _exit(0); } e

2014-05-20 23:00:19 177

转载 Linux中重定向及管道(ubuntu 终端命令)【转载】

1重定向 1.1     重定向符号 >              输出重定向到一个文件或设备 覆盖原来的文件 >!             输出重定向到一个文件或设备 强制覆盖原来的文件 >>            输出重定向到一个文件或设备 追加原来的文件              输入重定向到一个程序 1.2标准错误重定向符号 2>            将一个

2014-05-17 17:10:54 258

转载 ubuntu man手册完善

ubuntu man手册完善 Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可。 sudo apt-get install manpages-dev sudo apt-get install manpages-posix sudo apt-get install manpages-posix-dev sudo apt-get install

2014-05-12 19:30:21 309

原创 unix环境编程---简单模拟 ls -l

这个博客很久没有管过了,今天学了一点unix环境编程,

2014-04-26 17:13:35 317

原创 POJ 3253 Fence Repair

#include #include #include #include #include #include #include #include using namespace std; int n,s; struct cmp { bool operator ()(int x, int y) { return x > y; } }; priority_que

2013-09-07 20:50:27 374

原创 POJ 3069 Saruman's Army

#include #include #include #include #include #include #include using namespace std; int R , N; int an[1010]; int cmp(const void *a ,const void *b) { return *(int*)a-*(int*)b; } int main() {

2013-09-07 20:24:47 432

原创 POJ 3617 Best Cow Line

#include #include #include #include #include #include #include using namespace std; char s[4000]; int N; int main() { while(scanf("%d",&N)!=EOF) { for(int i=0;i<N;i++) {

2013-09-07 13:59:16 608

原创 vijos P1662 最大配对

#include #include #include #include #include #include #include using namespace std; int n,k; int an[100010]; int bn[100010]; int cmp1(const void *a,const void *b) { return *(int *)a-*(int *)b; }

2013-09-06 21:05:38 378

原创 vijos P1097 合并果子

#include #include #include #include #include #include #include #include using namespace std; int n,s; struct cmp { bool operator ()(int x, int y) { return x > y; } }; priority_que

2013-09-06 20:17:26 516

原创 vijos P1097

#include #include #include #include #include #include #include #include using namespace std; int n,s; struct cmp { bool operator ()(int x, int y) { return x > y; } }; priority_que

2013-09-06 20:16:21 83

原创 POJ 3278 Catch That Cow

BFS #include #include #include #include #include #include #include using namespace std; int N ,K; typedef pairP; queueque; int d[200010]; int bfs() { int time=0; P p; p.first=N; p.s

2013-09-06 18:05:06 334

原创 poj 2386 Lake Counting

搜索bfs #include #include #include #include int N,M; char map[110][110]; bool flag[110][110]; //int dir[8][2]={-1,1,0,1,1,1,-1,0,1,0,-1,-1,0,-1,1,-1}; int dir[8][2]={ {-1,1},{0,1},{1,1},{1,0},{1,-1}

2013-09-05 11:29:42 58

原创 UVA 102 Ecological Bin Packing

#include #include int B1,B2,B3,G1,G2,G3,C1,C2,C3; char str[6][4]={"BCG","BGC","CBG","CGB","GBC","GCB"}; int an[6]={0}; int main() { while(scanf("%d%d%d%d%d%d%d%d%d",&B1,&G1,&C1,&B2,&G2,&C2,&B3,&G3

2013-08-03 21:22:32 287

原创 汉诺塔hanoi

#include void hanoi(char A,char B,char C,int n) { if(n==1) { printf("Move disk %d from %c to %c\n",n,A,C); } else { hanoi(A,C,B,n-1); printf("Move disk %d

2013-07-21 11:06:36 224

原创 uva 673 Parentheses Balance

#include #include #include using namespace std; char s[200]; int T; stackS; int main() { int i,len; scanf("%d",&T); getchar(); while(T--) { gets(s); while(!S.empty(

2013-07-16 10:31:35 253

原创 uva 133 The Dole Queue

用循环双向链表模拟 #include #include #include struct s{ int num; struct s *qian; struct s *hou; int flag; }; int n,k,m; int main() { while(scanf("%d%d%d",&n,&k,&m)!=EOF) { i

2013-07-11 11:40:19 305

原创 uva 127 "Accordian" Patience

模拟,我也不知道开始错在那里,重新敲了一遍就过了 #include #include struct s { char c[60][5]; int s; }card[60]; void deal(int a,int b) { int x=card[a].s; int y=card[b].s; strcpy(card[a].c[x+1],card[b

2013-07-10 10:18:52 278

原创 uva 12503 Robot Instructions

#include #include int an[105]; int main() { int T; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); int sum=0; char s1[10],s2[10]; int t;

2013-07-09 20:36:00 353

原创 uva 12502 - Three Families

#include #include int main() { int T; scanf("%d",&T); while(T--) { int x,y,z; scanf("%d%d%d",&x,&y,&z); //int t=(x+y)/3; printf("%d\n",(2*x-y)*z/(x+y))

2013-07-09 15:02:14 308

原创 uva 10050 Hartals

#include #include #include int T,n,day; int an[10000]; int flag[10000]; int main() { scanf("%d",&T); while(T--) { //int n; memset(an,0,sizeof(an)); memset(flag,0,si

2013-06-04 17:20:44 297

原创 uva573 The Snail

#include #include #include #include double H,U,D,F; int main() { while(scanf("%lf%lf%lf%lf",&H,&U,&D,&F)!=EOF&&H) { int flag=0; int day=0; double climbH=0; do

2013-05-09 16:58:33 244

原创 10025 - The ? 1 ? 2 ? ... ? n = k problem

注意0就好 #include #include #include int main() { int T,n; scanf("%d",&T); while(T--) { scanf("%d",&n); n=(int)abs(n); int i,s=0; if(n==0) {

2013-05-09 12:12:46 293

原创 uva 575 - Skew Binary

今天水了一题 直接上代码,没什么好说的   #include #include #include #include char s[10000]; int main() { long long sum; while(scanf("%s",s)!=EOF) { if(!strcmp("0",s)) break;

2013-05-04 18:30:58 216

原创 uva 10970 - Big Chocolate

自己看代码,水题     #include int main() { int N,M; while(scanf("%d%d",&N,&M)!=EOF) { printf("%d\n",(N-1)+(M-1)*N); } return 0; }

2013-04-14 15:27:54 229

原创 uva 10014 Simple calculations

解题思路:推公式  (n+1)a1=n*a0+an+1-2*[(n-0)*c1+......+(n-n+1)*cn]     #include int main() { int T; scanf("%d",&T); while(T--) { int n,i; double a0,an,c,cn,a1; scanf

2013-04-13 18:05:14 202

原创 UVA 846 Steps

此题看了解题报告,觉得他的代码写的非常好,果断转他的了 #include #include int main() { int T,x,y,z,a; scanf("%d",&T); while (T--) { scanf("%d%d",&x,&y); if (y==x) printf("0"); else

2013-04-11 22:08:03 304

原创 UVA 11044 - Searching for Nessy

解题思路:水题目一枚,直接代码吧,注意的是最外面边界不用考虑 the border cells do not need to be controlled, because Nessy cannot hide there (she is too big).   #include #include #include int main() { int n,m,t; scanf(

2013-04-11 21:07:11 229

原创 uva 11044 - Searching for Nessy

解题思路:水题目一枚,直接代码吧,注意的是最外面边界不用考虑 the border cells do not need to be controlled, because Nessy cannot hide there (she is too big).

2013-04-11 21:04:53 86

原创 蛇形填数

#include #include #define MAX 10 int a[MAX][MAX]; int main() { int n,x,y,tot=0; while(scanf("%d",&n)!=EOF) { memset(a,0,sizeof(a)); tot=a[x=0][y=n-1]=1; while(tot<

2013-02-02 11:10:28 123

原创 uva694 The Collatz Sequence

其实就是3n+1问题,多了一个限制而已,运算时数据会超过int,开始用int64,发现uva用不了,改成longlong就可以了AC   #include void fun(long long A,long long L) { int flag=1; while(A!=1) { if(A%2!=0) A=A*3+1;

2013-01-28 12:29:25 173

原创 Uva 489 Hangman Judge

题意我理解了很久,英语不好的伤不起,把英文看懂就知道写了,纯模拟题,不难,题意明白就好,纯C写的   #include #include #define MAX 100 char s[MAX]; char s1[MAX]; int pang(char c); int f1(); void fun(); int pang(char c) { int i,flag=0; i

2013-01-28 11:19:18 247

原创 uva 488 Triangle Wave

#include void fun(int z,int p) { int i,j,k; for(i=0;i<p;i++) { for(j=1;j<=z;j++) { for(k=1;k<=j;k++) { printf("%d",j); }

2013-01-26 11:51:02 266

转载 gets getch getchar (puts......)

gets getch getchar  (puts......) getch 1、非C标准函数,头文件。 example:   char ch;或int ch;   getch();或ch=getch();   用getch();会等待你按下任意键,再继续执行下面的语句;   用ch=getch();会等待你按下任意键之后,把该键字符所对应的ASCII码赋给ch,再执行下面的语句

2012-10-27 20:36:49 435

原创 数据结构 遍历二叉树

遍历二叉树有三种方式 先序,中序,后序 区别就在于访问根节点的顺序 先序最先访问根节点,中序第二访问根节点,后序最后访问根节点

2012-10-27 14:41:52 162

转载 C++引用参数

原文http://www.cnblogs.com/charley_yang/archive/2010/12/14/1905161.html   把参数声明成引用,实际上改变了缺省的按值传递参数的传递机制,在按值传递时,函数操纵的是实参的本地拷贝。               一、引用参数的三种常见用法: 1.需要改变实参的值,比如swap()。参数是引用时,函数接收的是实参的左

2012-09-10 21:07:07 344

uml顺序图

uml顺序图

2013-06-15

递归论导论

递归论导论..................................

2012-07-28

空空如也

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

TA关注的人

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