在有些情况下我们需要按指定顺序输出数据,比如选择了ID in(3,1,2,5,4)我们希望按这个3,1,2,5,4的顺序输出,这样只使用order by ID是无法实现的,但是我们可以使用order by charindex(','+convert(varchar,ID)+',',',3,1,2,5...
分类:
数据库 时间:
2014-07-03 11:00:26
阅读次数:
352
使用C/C++扩展Python使用C/C++扩展Python翻译:gashero如果你会用C,实现Python嵌入模块很简单。利用扩展模块可做很多Python不方便做的事情,他们可以直接调用C库和系统调用。为了支持扩展,Python API定义了一系列函数、宏和变量,提供了对Python运行时系统的...
分类:
编程语言 时间:
2014-07-03 10:20:10
阅读次数:
381
多重背包,本题不需要二分优化。相对简单点。因为重复数十分小,小于10;
而增加一个限制每种材料的高度做法,如果使用逆向填表,那么只需要从这个高度往小递归填表就可以了。
还有就是注意要排序,以限制高度为标准从小到大排序,否则答案错误的。
#include
#include
#include
using std::sort;
const int MAX_K = 401;
const in...
分类:
其他好文 时间:
2014-07-01 16:08:42
阅读次数:
213
#!/usr/bin/pythonimporttelnetlibimportsockettry:tn=telnetlib.Telnet(‘10.67.21.29‘,60000)exceptsocket.error,e:printeexit(1)tn.set_debuglevel(1)tn.write(‘quit‘+‘\n‘)print‘ok‘socket.error为错误类型e为对象
分类:
编程语言 时间:
2014-07-01 15:33:07
阅读次数:
215
题意:排序后字符串全排列
思路:好久没水一题了
#include
#include
#include
#include
using namespace std;
const int MAXN = 220;
char str[MAXN];
int main() {
while (scanf("%s", str) != EOF) {
int n = strlen(str);
...
分类:
其他好文 时间:
2014-07-01 15:09:17
阅读次数:
182
题目链接:点击打开链接
右端点升序,取右端点
暴力删边
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define inf 10000000
#define ll int
#define N 2105
#define L(x) (x<<...
分类:
其他好文 时间:
2014-07-01 15:05:24
阅读次数:
214
把数组排成最小的数 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 输入一个正整数数组, 把数组里所有数字拼接起来排成一个数, 打印能拼接出的所有数字中最小的一个.大数转换为字符串, 重载快速排序的比较方法, 进行排序, 最后拼接.代码:/*
* main.cpp
*
* Created on: 2014.6.12
* Aut...
分类:
其他好文 时间:
2014-07-01 15:01:31
阅读次数:
248
Format characters have the following meaning; the conversion between C and Python values should be obvious given their types. The ‘Standard size’ column refers to the size of the packed value in bytes...
分类:
编程语言 时间:
2014-07-01 14:51:47
阅读次数:
391
1操作系统接口os模块提供了一系列与系统交互的模块:>>> os.getcwd() # Return the current working directory'/home/minix/Documents/Note/Programming/python/lib1'>>> os.chdir('~/p....
分类:
编程语言 时间:
2014-07-01 14:07:44
阅读次数:
249
发现科大网页的源码中还有文章的点击率,何不做一个文章点击率的降序排行。简单,前面入门(1)基本已经完成我们所要的功能了,本篇我们仅仅需要添加:一个通过正则获取文章点击率的数字;再加一个根据该数字的插入排序。ok,大功告成!简单说一下本文插入排序的第一个循环,找到列表中最大的数,放到列表 0 的位置做...
分类:
编程语言 时间:
2014-07-01 14:01:14
阅读次数:
245