04 2018 档案
摘要:欧几里得算法的原理:基于这样一种观察,两个整数x和y(x>y)的最大公约数等同于y和(x%y)的最大公约数; 数t整除x和y,当且仅当t整数y和(x%y);这是因为:x = t*y + x%y; 具体代码如下:
阅读全文
摘要:#include #include using namespace std; typedef struct node* list; struct node { int Item; list next; }; void Display(list head) { list t = head; while (nullptr != t) { ...
阅读全文
摘要:#include #include using namespace std; typedef struct node* list; struct node { int Item; list next; }; static void DisplayList(list head) { if (head->next == nullptr) { ...
阅读全文
摘要:#include #include int main(int argc, char *argv[]) { int i = 2, j = 0; long N = atol(argv[1]); int *a = malloc(N*sizeof(int)); if (NULL == a) { printf("There is no enough...
阅读全文