算法
wang_hua_yi
这个作者很懒,什么都没留下…
展开
-
P1036_选数
#include <bits/stdc++.h>using namespace std;const int N=5000005;int A[N];//质数数组 int T[N];//打表 int X[N];//输入的数字 int cn=0;int n,k,sum=0,cnt=0;void init(){ A[cn++]=2; int a=2; while(1){ for(int x=a;x<N;x+=a)T[x]=1; for(int x=a+1;;x++.原创 2022-01-27 23:52:44 · 235 阅读 · 0 评论 -
2021-10-10几种排序算法的实现
以前写过的几种排序算法代码,贴上。#include<iostream>#include<malloc.h>using namespace std;//namespace Sort{//选择排序[0,n)void SelectSort(int n,int a[]){ for(int i=0;i<n-1;i++) { int minIndex=i; for(int j=i+1;j<n;j++) { if(a[minIndex]>原创 2021-10-10 08:43:59 · 81 阅读 · 0 评论