随笔分类 -  算法学习

摘要:#include<iostream> using namespace std; int ysf(int n,int k,int i) { if( i == 1) return (n+k-1)%n; else return (ysf(n-1,k,i-1)+k)%n; } int main(void) 阅读全文
posted @ 2021-04-11 09:47 loliconsk 阅读(44) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<algorithm> #include<iostream> #include<cstring> using namespace std; const int maxn = 1000010; int pri[10000]; bool a[maxn]; 阅读全文
posted @ 2021-04-04 16:25 loliconsk 阅读(83) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<algorithm> #include<iostream> using namespace std; const int maxn = 1e5 + 5; void build(int root, int a[], int sum[], int st 阅读全文
posted @ 2021-04-03 09:58 loliconsk 阅读(40) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int total[500005]; int n,m; int lowbit(int x) { return(~x+1)&x; } void ad 阅读全文
posted @ 2021-04-02 18:42 loliconsk 阅读(49) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<algorithm> #include<iostream> #include<queue> using namespace std; const int maxn = 505; const int INF = 99999; struct node 阅读全文
posted @ 2021-03-26 19:53 loliconsk 阅读(139) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<set> #include<map> using namespace std; int a[1000005]; int main(void) { set<int> s; 阅读全文
posted @ 2021-03-14 16:04 loliconsk 阅读(82) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> using namespace std; const int maxn = 909529; int a[maxn],re 阅读全文
posted @ 2021-03-09 16:57 loliconsk 阅读(52) 评论(1) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int maxn = 1000; struct Bigint { int len, a[maxn] 阅读全文
posted @ 2021-02-26 18:13 loliconsk 阅读(91) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> using namespace std; int main(void) { const int n = 5; const int k = 3; int a[5] = { 2,3,3,5,6 }; int lb = -1, ub 阅读全文
posted @ 2021-02-19 10:22 loliconsk 阅读(37) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> #include<math.h> int queue[8]; int sum = 0; void show() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j+ 阅读全文
posted @ 2021-01-18 15:47 loliconsk 阅读(79) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> void prefix_table(char pattern[], int prefix[],int n) { prefix[0] = 0; int len = 0; int i = 1; 阅读全文
posted @ 2021-01-16 15:08 loliconsk 阅读(140) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; #include<vector> int main(void) { int n; cin >> n; string opr; string en; string gaizheng; vector<string> file 阅读全文
posted @ 2021-01-13 19:56 loliconsk 阅读(163) 评论(1) 推荐(0)
摘要:1.哈希表的声明文件 //静态哈希表 #pragma once #define MAX_SIZE 10 typedef int DateType; typedef enum { EXIST, EMPTY, DELET }state; //哈希表中的每一个节点 typedef struct HTEle 阅读全文
posted @ 2020-12-19 11:41 loliconsk 阅读(69) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> typedef struct node { int data; struct node* left; struct node* right; }Node; typedef struct tree { Node* root; } 阅读全文
posted @ 2020-12-15 18:01 loliconsk 阅读(173) 评论(0) 推荐(0)
摘要:#include<stdio.h> typedef struct Node { int data; struct Node* left; struct Node* right; }node; void prv(node* n) { if (n != NULL) { printf("%d\n", n- 阅读全文
posted @ 2020-12-12 19:30 loliconsk 阅读(40) 评论(0) 推荐(0)
摘要:#include<stdio.h> void hannoi(int n, char A, char B, char C) { if (n == 1) printf("%c -> %c\n", A, C); else { hannoi(n - 1, A, C, B); printf("%c -> %c 阅读全文
posted @ 2020-12-12 18:54 loliconsk 阅读(31) 评论(0) 推荐(0)
摘要:**归并排序代码** //mergeSort #include<stdio.h> #include<stdlib.h> //合并 void merge_Sort(int arr[], int L, int M, int R) { int left_size = M - L; int right_si 阅读全文
posted @ 2020-12-08 20:27 loliconsk 阅读(38) 评论(0) 推荐(0)