随笔分类 - 算法学习
摘要:#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)
阅读全文
摘要:#include<cstdio> #include<algorithm> #include<iostream> #include<cstring> using namespace std; const int maxn = 1000010; int pri[10000]; bool a[maxn];
阅读全文
摘要:#include<cstdio> #include<algorithm> #include<iostream> using namespace std; const int maxn = 1e5 + 5; void build(int root, int a[], int sum[], int st
阅读全文
摘要:#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
阅读全文
摘要:#include<cstdio> #include<algorithm> #include<iostream> #include<queue> using namespace std; const int maxn = 505; const int INF = 99999; struct node
阅读全文
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<set> #include<map> using namespace std; int a[1000005]; int main(void) { set<int> s;
阅读全文
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> using namespace std; const int maxn = 909529; int a[maxn],re
阅读全文
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int maxn = 1000; struct Bigint { int len, a[maxn]
阅读全文
摘要:#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
阅读全文
摘要:#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+
阅读全文
摘要:#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;
阅读全文
摘要:#include<iostream> using namespace std; #include<vector> int main(void) { int n; cin >> n; string opr; string en; string gaizheng; vector<string> file
阅读全文
摘要:1.哈希表的声明文件 //静态哈希表 #pragma once #define MAX_SIZE 10 typedef int DateType; typedef enum { EXIST, EMPTY, DELET }state; //哈希表中的每一个节点 typedef struct HTEle
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef struct node { int data; struct node* left; struct node* right; }Node; typedef struct tree { Node* root; }
阅读全文
摘要:#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-
阅读全文
摘要:#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
阅读全文
摘要:**归并排序代码** //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
阅读全文

浙公网安备 33010602011771号