c++
jKingle
这个作者很懒,什么都没留下…
展开
-
八皇后问题c++解法
#include <iostream>using namespace std;//递归算法解决八皇后问题。总共有92种解法。int c[20], n=8, cnt=0;void print(){ for(int i=0; i<n; ++i){ for(int j=0; j<n; ++j){ if(j == c[i]...原创 2018-10-29 15:00:10 · 7542 阅读 · 11 评论 -
多种排序算法c++(冒泡排序、直接插入排序、快排算法、直接选择、归并排序)
#include<iostream>using namespace std;void fn(int arr[],int n)//冒泡排序{ for(int i=0;i<n-1;i++) { for(int j=0;j<n-i-1;j++) { if(arr[j]>arr[j+1]) ...原创 2018-10-29 15:04:09 · 318 阅读 · 0 评论 -
连续子字符串(最长子字符串)c++
#include<iostream>#include<vector>using namespace std;int maxcaculate(string a,string b,string *&c){ int m,n,th; int count1=0,maxx=0; for(int i=0;i<a.length();i++){...原创 2018-10-29 15:07:52 · 1162 阅读 · 0 评论