- 博客(28)
- 收藏
- 关注
原创 将整数分解为连续正整数之和
将一个整数 N 分解为连续正整数之和,如 15 可以分解为: 15 = 1 + 2 + 3 + 4 + 515 = 4 + 5 + 615 = 7 + 8=============================================计算从 i 开始连续 k 个数之和: sum = k * (2 * i + k - 1) / 2; 当 sum == N...
2013-11-28 10:58:28
1123
python3 的 map
python 2 的 map 返回 list python 3 的 map 返回 “(可迭代)map 类” Python 3.2.3 (default, Feb 20 2013, 17:02:41) [GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information....
2013-11-25 05:55:12
159
xfce4 终端提示音的设置
Debian7.2 原生 Xfce4.8 环境下的终端(xfce4-terminal)默认是没有提示音的。但是在 Gnome3 环境下的终端 gnome-terminal 默认就有提示声音,而且声音很柔和。于是,希望 xfce4-terminal 也有提示音。网上搜不到解决方案,至少 Baidu 搜不到。Google 又上不去。 基本解决方法:$ vim ~ /.conf...
2013-11-21 23:18:10
672
原创 Python 一行读入多个整数/字符串
http://www.cnblogs.com/skyhacker/archive/2012/02/03/2337572.htmlhttp://blog.youkuaiyun.com/demon24/article/details/8502565 I=lambda:map(int,raw_input().split())n,k=I()a=I()
2013-11-15 01:57:38
1047
TypeError: 'str' does not support the buffer interface
摘要: If you use Python3x then string is not the same type as for Python 2.x, you must cast it to bytes (encode it).In python 3, bytes strings and unicode strings are now two different types. When...
2013-11-10 03:07:28
161
Debian 7 Xfce4.8 环境下 安装 Iceweasel 的 flash 插件
摘要:1. Gnome3 的 “后备模式” 是不错的桌面环境,是类似 Gnome2 的经典环境。 2. 官方提供的 *-netinst.iso 安装镜像可以选择其它桌面环境(默认为 Gnome 3,但可以选择 KDE、Xfce 和 LXDE 等环境),而且体积很小(不到 300 M)。另外,使用 netinst 是要联网的,安装过程中要从网络下载软件。网络环境不好就不要使用 neti...
2013-11-08 18:34:58
316
firefox 打开“百度百科-Unicode”页面 假死
我的 firefox 25 无法顺利打开如下页面(百度百科-Unicode),http://baike.baidu.com/link?url=XnTT9fKXcYZTW80n1ZBvC0KODYuSt5ufRU2-Esz5kZlhI3CJhdOQfAJHbVLiz5XB 一直“未响应”。。。 cpu 老高。。。 ...
2013-11-06 01:41:08
144
Firefox 25 无法访问 UVa OJ
Firefox 检测到该服务器正在将此地址的请求循环重定向。 两年前,同样的问题。http://yeeboo.iteye.com/blog/975606 删了 cookie 也没用。 ...
2013-10-30 15:18:58
207
POJ 3278
// 百度空间太 2B 了。一点儿都不好用,垃圾。 // 非 STL 版。// (C++) AC 916K 16MS (C:编译错误)// (G++ / Gcc) AC 1104K 16MS #include <stdio.h>int main() { int visited[100001] = {0}; ...
2013-10-28 20:05:55
95
[摘抄] C 专家编程
P61/*在结构中放置数组*/struct s_tag { int a[100]; };“现在,你可以把数组当作第一等级的类型,用赋值语句拷贝整个数组,以传值调用的方法把它传递到函数,或者把它作为函数的返回类型。”----------------------------------------------------------- P57...
2011-10-11 21:55:22
90
QQ 传输文件,接收大小与实际大小不符
version : QQ2010 正式版 SP2.1 (1840) 最近使用 QQ 来传输文件,结果总是出错。 同学传给我的 40M+ 的 pdf,QQ 说“接收成功”,结果一看,只有 38M,adobe reader 打不开,说“文件损坏”。 还有一次,我接收同学传来的 740M+ 的 rmvb 视频文件,QQ 也说“接收成功”,结果一看,只有 24M —— 一个多小时的...
2011-08-03 10:22:32
1223
1
[札记] vim 命令及快捷键
vim 6.3.82 【命令模式】 shift + 3 即 # ,向上查找光标所在位置的词,相当于 ?word。 shitf + 8 即 * ,向下查找光标所在位置的词,相当于 /word,...
2011-07-27 11:56:25
123
[发泄] vim 自带的配置文件的位置
系统自带的 ( vim 的 ) 配置文件 ( 的位置 ) : /etc/vimrc 本来是忘了 vim 自带的配置文件的位置,想找到看一下。所以就上网搜“vim 自带 配置文件”,,结果搜出来的全是 ~/.vimrc 。这个叫“用户配置文件”,好不好!太垃圾了,好几个人的文章简直一模一样,还不注明转载。实在恼火。发泄一下。...
2011-07-07 10:50:34
124
[C/C++] struct 成员的偏移地址的求法
例如 typedef struct struc { int a; char b[20]; double ccc; }; 现想要求 b 相对于 struc 的偏移地址。 其实,很早就知道有 (size_t)&(((struc*)0)->b) 这种写法。昨天,舍友在第三版“面试宝典”上看到这种“...
2011-06-16 22:51:06
319
原创 [随时更新] & | ~ ^ 位运算的蛋疼妙用
1. 交换两个数但不能使用临时变量// method 1void swap (int* a, int* b) { *a ^= *b; *b ^= *a; *a ^= *b;} // method 2void swap (int* a, int* b) { // 乘号改成加号时,除号改成减号。 // ...
2011-06-15 21:31:29
108
新手在 fedora 14 下安装 firefox 的过程
实验室的电脑上装了一个 fedora14 (很早以前的事了),但一直没怎么用,所以还是个新手,真实惭愧。 今天没啥事,用了一下。发现 firefox 居然还是自带的 3.6 版本,这怎么可以。马上在 http://firefox.com.cn/ 上下载了一个 Firefox-latest.tar.bz2 又在 http://www.mozilla.com/en-US/firefox/fx/...
2011-05-16 17:22:06
314
原创 UVa 10361 的分词
题目 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=1302 这题的描述还算正常。两个字符串,一个是“s1<s2>s3<s4>s5”,另一个是“s6...”,输出s...
2011-03-24 19:42:21
109
UVa 488 输出形式图解
题目 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=429 本来题目中已经说“The outputs oftwo consecutive cases will be separa...
2011-03-24 13:59:47
210
安装Qt后,多余文件
我安装的是Qt4.7.1(qt-sdk-win-opensource-2010.05)。 昨天,在实验室安装的时候就出现过。主要情况就是:安装后,会在安装目录的上一级目录出现一些多余的文件,如下图 上图中,用红色标记的均为多出来的文件。居然还都是2007年创建的!!?这些文件应该是可以删掉的吧。 整理了一下 ...
2011-01-14 10:50:08
176
原创 A Joke
Macs are for those who don't want to know why their computer works. Linux is for those who want to know why their computer works. DOS is for those who want to know why their computer doesn't wor...
2011-01-09 17:17:29
106
原创 There's always a little ...
There's always a little truth behind every "JUST KIDDING", a little knowledge behind every "I DON'T KNOW", a little emotion behind every "I DON'T CARE", and a little pain behind every "IT'S OK".
2010-12-20 23:56:17
165
Arena 乱码的解决
Arenais a FREE available Graphical User Interface (GUI) for chess programs (engines) by Martin Blume. Arena runs on Win95, NT4 or higher MicrosoftOS versions.Arena is c...
2010-11-01 14:35:23
531
杂 of linux
// 不定期更新 1. create函数,没有字母e!!!$ man 2 creat #include <sys/types.h> // 这么多头文件 #include <sys/stat.h> #include <fcntl.h> int open(const char *p...
2010-10-08 22:32:46
77
原创 一首诗
Maybe God wants us to meet a few wrong people before meeting the right one so that when we finally meet the right person, we will know how to be grateful for that gift.When the door of happine...
2010-09-24 16:39:19
138
[GreenHand] Fedora 快捷键 运行“终端”
在 VMWare7.1 下安装了 Fedora13. 图 1有两个“终端”。 希望可以象 Windows 那样用 Win+R 然后输入命令来运行程序(比如按 Win+R 后输入 cmd 来运行命令行)。我呢,就是想按 Win+R 后输入某一个命令来运行“终端”(这里的“终端”不是指 konsole)。 网上有很多添加快捷键的方法,大部分都是要输入命令的(至少我搜...
2010-09-23 00:12:51
292
原创 五子棋人机对弈软件“黑石”的官方网站是什么?
等我找到了再说吧...////////////////////////////////////////////////////////////////////////////////////////////////////
2010-06-27 22:43:59
515
test--C二进制文件读取-2008.12.10号
//IDE: Visual Studio 2008 #include "stdafx.h" #include <string.h> const int nmemb = 3; struct test { char name[20]; int size; }s[nmemb]; void set_s(int x, char* y){ strcpy(s[x]....
2008-12-10 22:46:01
96
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人