- 博客(9)
- 资源 (2)
- 收藏
- 关注
转载 操作系统的一些宏
编译器GCC#ifdef __GNUC__#if __GNUC__ >= 3 // GCC3.0以上Visual C++#ifdef _MSC_VER(非VC编译器很多地方也有定义)#if _MSC_VER >=1000 // VC++4.0以上#if _MSC_VER >=1100 // VC++5.0以上#if _MSC_VER >=1200 // VC++6.
2014-07-24 23:01:22
515
原创 输出链表中倒数第m个元素
// 输出链表中倒数第m个元素.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include struct Node{ int value; struct Node *next; };Node *createLinklist(int length){ Node *head, *last
2013-09-29 23:24:11
564
原创 判断一个单链表中是否有环
// 判断一个单链表中是否有环.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include //定义单链表的长度const int length = 22;//定义单链表中环的起点const int circularNum = 11;struct Node{ int value; struct Node *next
2013-09-28 21:44:21
439
原创 删除一个字符串中连续的空格
// 删除一个字符串中连续的空格.cpp : 定义控制台应用程序的入口点。////问题描述:给定一个字符串,如果字符串中存在连续多个空格则用一个空格代替.//例如:输入:ab--cd-ef---g 输出:ab-cd-ef-g,为了方便,用-代替空格//解决问题:写两个循环...第一个循环读到空格就使用第二个循环判断连续空格的数量..//在第二个循环中一旦一个字符不是空格,就跳出本循环
2013-09-27 21:02:46
982
原创 输出任意多个序列的排列组合
// 输出任意多个序列的排列组合.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include #include #include using namespace std;int iResult[10];static int iNum = 0;void solve( cons
2013-09-26 23:21:13
960
原创 求数组的最长递增子序列
// 求最长递增子序列.cpp : 定义控制台应用程序的入口点。//动态规划思想#include "stdafx.h"#include#include using namespace std;int dynamicProgram(int *arry,int n){ //list[i]存储着以arry[i]为最后一个元素的序列(该序列是递增子序列)的长度 int *list
2013-09-26 00:12:13
397
原创 求数组的子数组之和的最大值
// 求数组的子数组之和的最大值.cpp : 定义控制台应用程序的入口点。#include "stdafx.h"#include using namespace std;//求数组的子数组之和的最大值为负时,直接返回0int MaxSum(int * a, int n){ int sum=0; int b=0; sum = b = 0; for(int i=1; i<
2013-09-24 23:43:20
402
原创 求最大连续子序列乘积
// 求最大连续子序列乘积.cpp : 定义控制台应用程序的入口点。//****************************动态规划方法********************************#include "stdafx.h"#include #include int max(int x, int y, int z){ int temp = x>y?x:y;
2013-09-24 23:40:35
546
原创 求两个字符串的最长公共子序列
// 求两个字符串的最长公共子序列.cpp : 定义控制台应用程序的入口点。#include "stdafx.h"#include#include#define N 10using namespace std;void longest(string s1,string s2){ int i,j; int a[N][N]; for(i
2013-09-23 23:31:04
832
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人