上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 74 下一页

2025年11月29日

5-9 Huffman Codes (30分)

摘要: #include <iostream> #include <queue> #include <vector> #include <string.h> using namespace std; int judge(char a[], char b[], int alen, int blen) { in 阅读全文

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

5-8 哈利·波特的考试 (25分)

摘要: #include <iostream> #include <vector> #include <string.h> using namespace std; struct node { int next, dis; }; int tree[110], sum[110], flag[110]; int 阅读全文

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

5-8 File Transfer (25分)

摘要: #include <iostream> using namespace std; int tree[10010], sum[10010]; void init(int n) { int i; for(i = 1; i <= n; i++) { tree[i] = -1; sum[i] = 1; } 阅读全文

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

5-7 六度空间 (30分)

摘要: #include <iostream> #include <vector> #include <queue> #include <string.h> using namespace std; vector<int> v[10010]; queue<int> q; int vis[10010], le 阅读全文

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

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 王景迁 阅读(10) 评论(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 王景迁 阅读(18) 评论(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 王景迁 阅读(8) 评论(0) 推荐(0)

2025年11月25日

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 王景迁 阅读(13) 评论(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 王景迁 阅读(11) 评论(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 王景迁 阅读(8) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 74 下一页

导航