摘要: 文本终端的颜色可以使用“ANSI非常规字符序列”来生成。举例: echo -e "\033[44;37;5m ME \033[0m COOL" 以上命令设置作用如下:背景色为蓝色,前景色为白色,字体闪烁,输出字符“ME”,然后重新设置屏幕到缺省设置,输出字符 “COOL”。“e”是命令 echo 的一个可选项,它用于激活特殊字符的解析器。“\033”引导非常规字符序列。“m”意味着设置属性然后结束非常规字符序列,这个例子里真正有效的字符是 “44;37;5” 和“0”。修改“44;37;5”可以生成不同颜色的组合,数值和编码的前后顺序没有关系。 可以选择的编码如下所示: 编 阅读全文
posted @ 2013-11-19 13:58 fly_lovelove 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1. 取出两个文件的并集(重复的行只保留一份)cat file1 file2 | sort | uniq 2. 取出两个文件的交集(只留下同时存在于两个文件中的文件)cat file1 file2 | sort | uniq -d 3. 删除交集,留下其他的行cat file1 file2 | sort | uniq -u如果需要计数也有一个很好的参数uniq -c 可以将相同行数的计数放在行首sort排序是根据从输入行抽取的一个或多个关键字进行比较来完成的。排序关键字定义了用来排序的最小的字符序列。缺省情况下以整行为关键字按ASCII字符顺序进行排序。改变缺省设置的选项主要有:– m 若给定 阅读全文
posted @ 2013-11-19 13:39 fly_lovelove 阅读(659) 评论(0) 推荐(0) 编辑
摘要: 方法1:system("........");里面加相应的命令代码方法二:在QT中需加头文件#include 启动外部shell等命令代码,可以多任务执行,不会阻塞主程序QProcess *process = new QProcess;QStringList str;str start("./WinMerge/WinMergeU.exe",str);外部程序退出,主程序不会退出,所以加上下面的代码判断f(process)process->close();delete process;process = 0; 阅读全文
posted @ 2013-11-19 12:05 fly_lovelove 阅读(1546) 评论(0) 推荐(0) 编辑
摘要: 简单的命令:一下命令一般用在if[]; thenfi 条件判断中-e filename 如果 filename存在,则为真-d filename 如果 filename为目录,则为真 -f filename 如果 filename为常规文件,则为真-L filename 如果 filename为符号链接,则为真-r filename 如果 filename可读,则为真 -w filename 如果 filename可写,则为真 -x filename 如果 filename可执行,则为真-s filename 如果文件长度不为0,则为真-h filename 如果文件是软链接,则为真filen 阅读全文
posted @ 2013-11-08 19:40 fly_lovelove 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 感觉还是用csdn方面 阅读全文
posted @ 2013-08-31 14:21 fly_lovelove 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 只要有三点以上可以成环即可,自己想想为什么,用到拓扑排序,是否成环 #include #include #include using namespace std;char s[2001][2001];int ingree[2001],n;stack v;int solve(){ while(!v.empty()) v.pop(); for(int i = 1;i 0) { ingree[i] --; if(ingree[i] == 0) v.push(i); ... 阅读全文
posted @ 2013-08-22 15:11 fly_lovelove 阅读(256) 评论(0) 推荐(0) 编辑
摘要: gxx的素数判定模板typedef long long LL;bool primeTest(LL n, LL b) { LL m = n - 1; LL counter = 0; while ((m & 1) == 0) { m >>= 1; counter ++; } LL ret = powMod(b, m, n); if (ret == 1 || ret == n - 1) { return true; } counter --; while (counter >= 0) { r... 阅读全文
posted @ 2013-08-16 23:54 fly_lovelove 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #include #include #define N 60005struct st{ int x,y,sum,flag;}p[N * 4];void build(int r,int x,int y){ p[r].x = x; p[r].y = y; p[r].sum = 0; p[r].flag = 0; if(x == y) return ; int mid = (x + y) >> 1,tem = r > 1,tem = r mid) sum = query(tem + 1,x,y,val); else s... 阅读全文
posted @ 2013-07-31 09:20 fly_lovelove 阅读(169) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;#define N 1000001int a[N],n;void headjust(int i,int size){ int left = i * 2,right = left + 1; int max = i; if(i a[max]) max = left; if(right a[max]) max = right; if(max != i) { swap(a[i],a[max]); ... 阅读全文
posted @ 2013-07-23 15:12 fly_lovelove 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题目:There are n numbers with the corresponding NO.1-n, and the value of the i-th number is xi.Define three operations: 1.Division a b c, in the interval [a,b], if the value of a number is equal or greater than zero, then its value changed to it divide C(integer division). (1 <= a <= b <= n, 阅读全文
posted @ 2013-04-17 11:27 fly_lovelove 阅读(242) 评论(0) 推荐(0) 编辑