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

2025年11月29日

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 王景迁 阅读(3) 评论(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 王景迁 阅读(2) 评论(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 王景迁 阅读(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)

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 王景迁 阅读(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)

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

导航