10 2021 档案
摘要:写法1: #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> void shift(int* isPrime, int n, int i) { for (int j = 2 * i; j < n; j +=
阅读全文
摘要:#include<iostream> #include<string> using namespace std; int GCD(int x, int y) {//求两个数的最大公因数;可改为bool类型函数,判断x,y是否为素数即可; return y == 0 ? x : GCD(y, x %
阅读全文
摘要:方法1:穷举 #include<iostream> using namespace std; int main(){ int m = 123,i;//求11mod123的逆元 for (i = 2; (11*i-1)%123!=0; i++); cout << i; system("pause");
阅读全文
摘要:#include<iostream> using namespace std; int GCD(int &a, int &b) { int remainder; if (b != 0) while (true) { remainder = a % b; if (remainder == 0) ret
阅读全文
摘要:#include<iostream> using namespace std; int GCD(int x, int y) { return y == 0 ? x : GCD(y, x % y); } int main() { int x, y; x=GCD(169, 121); cout << "
阅读全文
摘要:定义节点头文件 #ifndef _DBLNODE_H_ #define _DBLNODE_H_ template<class ElemType> struct Node{ ElemType data; Node<ElemType>* back; Node<ElemType>* next; Node(
阅读全文
摘要:template<class ElemType> void Reverse(SimpleLinkList<ElemType>& la) { ElemType hElem, tElem; for (int pos = 1; pos <= la.Length()/2; pos++) { la.GetEl
阅读全文
摘要:template<class ElemType> void MergeList(const SimpleLinkList <ElemType>& la, const SimpleLinkList<ElemType>& lb,SimpleLinkList <ElemType>& lc) { ElemT
阅读全文
摘要:定义头节点 #ifndef _NODE_H_ #define _NODE_H_ //构造函数模板 template<class ElemType> struct Node { ElemType data; Node<ElemType>* next; Node();//无参的函数构造模板 Node(c
阅读全文
摘要://头文件sq_list.h #define _SQ_LIST_H_ #ifndef DEFAULT_SIZE #define DEFAULT_SIZE 1000//缺省元数个数 //顺序表模板 template <class ElemType> class SqList { protected:/
阅读全文

浙公网安备 33010602011771号