摘要:
方法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:/ 阅读全文