反转字符串

#include <iostream>#include <cstring>using namespace std;int main(){ //源字符串 char str[100]; cin.get(str, 100); //申请目标字符串的空间 size_t strLen = strlen(str); char *des = new char[strLen + 1]; //源字符串上一次空格的位置 size_t lastIndex = 0; for (size_t i = 0; i <= strLen; ++i) { ...
默认分类 | 2012-05-17 23:34 | 阅读 1582 次 | 评论 0 条

素数环 python递归求解

#-*- coding: gbk -*-#素数环def IsPrimeNum(num): for i in range(2, num): if num % i == 0: return False return True def GetPrimeDic(n): Dic = {} for i in range(1, n+1): Dic[i] = [] for i in range(1, n+1, 2): #even number for j in range(2...
默认分类 | 2012-05-12 06:41 | 阅读 3538 次 | 评论 0 条
浏览31022次