随笔分类 -  刷题

上一页 1 2 3 4 5 6 ··· 8 下一页

5-5 堆中的路径 (25分)
摘要:#include <iostream> using namespace std; int num[1010]; void adjustup(int k) { num[0] = num[k]; int i = k / 2; while(i > 0 && num[0] < num[i]) { num[k 阅读全文

posted @ 2025-11-29 14:57 王景迁 阅读(3) 评论(0) 推荐(0)

5-4 是否同一棵二叉搜索树 (25分)
摘要:#include <iostream> using namespace std; struct node { int lchild, rchild, key; }tree1[10], tree2[10]; int index = -1; void initnode(node tree[], int 阅读全文

posted @ 2025-11-29 14:56 王景迁 阅读(2) 评论(0) 推荐(0)

5-3 树的同构 (25分)
摘要:#include <iostream> #include <string.h> using namespace std; struct node { int lchild, rchild; char key; }tree1[10], tree2[10]; int flag[10]; int geti 阅读全文

posted @ 2025-11-29 14:55 王景迁 阅读(1) 评论(0) 推荐(0)

1102. Invert a Binary Tree (25)
摘要:#include <iostream> #include <queue> using namespace std; struct node { int lchild, rchild, key; }tree[10]; queue<int> q; int flag, first = 1, bfscoun 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(3) 评论(0) 推荐(0)

1103. Integer Factorization (30)
摘要:#include "stdafx.h" #include <iostream> #include <algorithm> #include <queue> #include <string.h> using namespace std; vector<int> path, res; int k, p 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(4) 评论(0) 推荐(0)

1104. Sum of Number Segments (20)
摘要:#include <iostream> using namespace std; double num[100010]; int main() { int n; scanf("%d", &n); int i; for(i = 1; i <= n; i++) { scanf("%lf", &num[i 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(2) 评论(0) 推荐(0)

1105. Spiral Matrix (25)
摘要:#include <iostream> #include <algorithm> #include <algorithm> using namespace std; int num[10010], arr[110][110]; int cmp(int a, int b) { return a > b 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(5) 评论(0) 推荐(0)

1106. Lowest Price in Supply Chain (25)
摘要:#include <iostream> #include <vector> #include <queue> using namespace std; double p, r; vector<int> v[100010]; queue<int> q; int flag, bfscount; void 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(4) 评论(0) 推荐(0)

1107. Social Clusters (30)
摘要:#include <iostream> #include <vector> #include <algorithm> using namespace std; int tree[1010], sum[1010]; vector<int> v[1010]; int cmp(int a, int b) 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(4) 评论(0) 推荐(0)

1108. Finding Average (20)
摘要:#include <iostream> #include <string.h> using namespace std; int main() { int n; scanf("%d", &n); int i, len, xiaoshu, j, begin, pointcount, flag, num 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(5) 评论(0) 推荐(0)

1109. Group Photo (25)
摘要:#include <iostream> #include <string.h> #include <algorithm> using namespace std; struct node { int height; char name[10]; }people[10010]; char res[10 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(4) 评论(0) 推荐(0)

1110. Complete Binary Tree (25)
摘要:#include <iostream> #include <queue> #include <string.h> using namespace std; struct node { int lchild, rchild; }tree[30]; queue<int> q; int res = 1, 阅读全文

posted @ 2025-11-25 09:10 王景迁 阅读(4) 评论(0) 推荐(0)

1111. Online Map (30)
摘要:#include <iostream> #include <vector> #include <string.h> using namespace std; struct node { int next, length, time; }; void print(vector<int> v) { in 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(5) 评论(0) 推荐(0)

1112. Stucked Keyboard (20)
摘要:#include <iostream> #include <string.h> #include <vector> using namespace std; int flag[130]; void print(vector<char> v) { int i, size = v.size(); for 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(3) 评论(0) 推荐(0)

1113. Integer Set Partition (25)
摘要:#include <iostream> #include <algorithm> using namespace std; int num[100010]; int main() { int n; scanf("%d", &n); int i, sum = 0; for(i = 1; i <= n; 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(3) 评论(0) 推荐(0)

1114. Family Property (25)
摘要:#include <iostream> #include <vector> #include <algorithm> #include <string.h> using namespace std; int tree[10000], sum[10000], flag[10000], estate[1 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(5) 评论(0) 推荐(0)

1115. Counting Nodes in a BST (30)
摘要:#include <iostream> #include <queue> using namespace std; struct node { int lchild, rchild, key; }tree[1010]; int index = -1, n1, n2; queue<int> q; vo 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(4) 评论(0) 推荐(0)

1116. Come on! Let's C (20)
摘要:#include <iostream> #include <math.h> using namespace std; int finalrank[10000]; int judge(int n) { int i, r = sqrt(n * 1.0); for(i = 2; i <= r; i++) 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(5) 评论(0) 推荐(0)

1117. Eddington Number(25)
摘要:#include <iostream> #include <algorithm> using namespace std; int num[100010]; int getindex(int low, int high, int goal) { int mid; while(low < high) 阅读全文

posted @ 2025-11-25 09:07 王景迁 阅读(4) 评论(0) 推荐(0)

1118. Birds in Forest (25)
摘要:#include <iostream> #include <vector> using namespace std; int flag[10010], sum[10010], tree[10010]; vector<int> v; void init(int id) { tree[id] = -1; 阅读全文

posted @ 2025-11-25 09:06 王景迁 阅读(4) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 8 下一页

导航