摘要: 1.$0-$9及$# $@的使用demo_arg 内容#!/bin/bashecho "程序名:$0"echo "命令传递参数个数:$#"echo "参数值分别是:$1 $2 $3 $4 $5 $6 $7 $8 $9"echo "所有参数:$@"exit 0终端命令:$chmod u+x demo_arg$./demo_arg a b c d e f g h i2.set用法demo_set内容#!/bin/bashfilename="$1"set $ (ls -il $filename)ino 阅读全文
posted @ 2013-11-20 20:20 枫月寒 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 1.生成test可执行文件,源文件有prog.c prog.h cord.htest:prog.o code.o gcc -o test prog.o code.oprog.o:prog.c prog.h code.h gcc -c prog.c -o prog.ocode.o:code.c code.h gcc -c code.c -o code.oclean: rm -f *.o#最后是删除所有的.o文件执行:$make target 或者 make test2.带变量的makefileOBJS=prog.o code.oCC=gcctest:${ OBJS } ... 阅读全文
posted @ 2013-11-19 11:06 枫月寒 阅读(504) 评论(0) 推荐(0) 编辑
摘要: http://dl.newhua.com/down/qt-creator-windows-opensource-2.6.2.zip还有一本书http://static.ishare.down.sina.com.cn/9428346.pdf?ssig=fnpTBn1He9&Expires=1365782400&KID=sina,ishare&ip=1365683712,119.108.57.&fn=C%2B%2B+GUI+Qt4+%E7%BC%96%E7%A8%8B+%EF%BC%88%E7%AC%AC%E4%BA%8C%E7%89%88%EF%BC%89.pdf 阅读全文
posted @ 2013-04-11 20:23 枫月寒 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题目描述:http://poj.org/problem?id=3624基本的01背包dp[i-1][v]=max{dp[i-1][v],dp[i-1][v-weight[i]]+value[i]}#include<stdio.h>#include<memory.h>int max(int a,int b){ return a>b?a:b;}int w[3500],v[3500],dp[13000];void main(){ int n,m,i,j,sum; scanf("%d%d",&n,&m); sum=0; memset(d 阅读全文
posted @ 2012-05-30 20:27 枫月寒 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1502dijkstra算法应该是水题,但自己第一次写,贡献了好多wrong。。。最后0MS 也對得住wrong的那几次了#include <stdio.h>#include <stdlib.h>#include <string.h>#define Max 0x3f3f3f3fint tu[150][150];int set[150];int sum[150];void init(int n){ int i,j; for(i=1;i<=n;i++) { for(j=1;j<=n;j++ 阅读全文
posted @ 2012-04-19 18:11 枫月寒 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3041没看题,网上搜最大二分匹配搜到的匈牙利算法,深搜一次最多增加一个匹配代码:#include <stdio.h>#include <stdlib.h>int tu[505][505];int mx[505],my[505];int flag[505];short dfs(int n,int s){ int i; for(i=1;i<=n;i++) { if(tu[s][i]==1&&flag[i]==0) { flag[i]=1; if(... 阅读全文
posted @ 2012-04-18 09:09 枫月寒 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目描述:http://poj.org/problem?id=2421prim最小生成树将题目中的存放图的数组值置为-1当a,b已经建好时,将map[a][b]=0;map[b][a]=0;(map是存放图的数组)代码:#include <stdio.h>#include <stdlib.h>int map[150][150],road[150],k;int key[150],sum;short flag[150];void prim(int r,int n){ int i,j,min; for(i=1;i<=n;i++) { key[i]=10001; ... 阅读全文
posted @ 2012-04-16 15:39 枫月寒 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1459题目意思让我放弃了好几回,今天终于耐下心来读懂了就不说题目意思了 看看输入输出:Sample Input2 1 1 2 (0,1)20 (1,0)10 (0)15 (1)207 2 3 13 (0,0)1 (0,1)2 (0,2)5 (1,0)1 (1,2)8 (2,3)1 (2,4)7 (3,5)2 (3,6)5 (4,2)7 (4,3)5 (4,5)1 (6,0)5 (0)5 (1)2 (3)2 (4)1 (5)4Sample Output1562 1 1 2 (0,1)20 (1,0)1... 阅读全文
posted @ 2012-04-16 12:26 枫月寒 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1146此题求所给字符串按字典序的下一个由原串字母排列的串,题目不难,开始看错了,wrong一次#include <stdio.h>#include <stdlib.h>#include <string.h>int main(int argc, char** argv) { char a[55],temp; int k,i,j,flag,t; while(scanf("%s",a)&&a[0]!='#') { flag=-1; k=strlen( 阅读全文
posted @ 2012-04-10 12:09 枫月寒 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 既然选择,就好好努力吧! 阅读全文
posted @ 2012-04-04 21:45 枫月寒 阅读(108) 评论(0) 推荐(0) 编辑