各种算法
fatship
信息学教练员
展开
-
快排复习
#include #include using namespace std;int a[100000];int n;void qsort(int s , int e){ int i , x , l , r; l = s; r = e; x = a[s]; if (l >= r) return; while ( l { while (l r--; a[l]原创 2009-02-02 07:31:00 · 784 阅读 · 2 评论 -
简单迷宫
#include #include using namespace std;int s[100][100];int x , y , x0 , x1 , y0 , y1;void so(int y , int x){ if (s[y][x] == 1 || s[y][x] == 2) return; s[y][x] = 2; so(y - 1 , x); so(y , x - 1);原创 2009-02-03 16:28:00 · 738 阅读 · 0 评论 -
三种基础排序
一、选择法排序 #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int s[2000], n; int i, j; cin >> n; for ( i = 0 ; i &...原创 2019-01-06 16:18:12 · 499 阅读 · 1 评论 -
两种质数求法——筛法、推法
首先写出推法求质的程序,思想就是拿前面的质数来确定当前验证的数字为合数。从而,将为确定为合数的数确定为质数,逐渐的加到数组里。 推法求质: #include <cstdlib> #include <fstream> #include <cmath> using namespace std; ifstream cin("zhi.in"); ofstream ...原创 2019-03-28 18:57:55 · 409 阅读 · 0 评论