PAT
hustwgp
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1098 Insertion or Heap Sort (25 分)
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define PARANT(x) (((x)-1) >> 1)#define LCHILD(x) (((x) << 1) + 1)#define RCHILD(x) (((x) + 1) << 1)#define INHEAP(n, x) (((x) >= 0) .原创 2021-08-21 23:46:48 · 227 阅读 · 0 评论 -
1066 Root of AVL Tree (25 分)
#include <iostream>#include <algorithm>using namespace std;typedef struct TreeNode{ int val, height; TreeNode *left, *right;} TreeNode;TreeNode *root = nullptr;int getheight(TreeNode *node){ if (node == nullptr) re.原创 2021-08-18 17:10:27 · 198 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分)
#include <vector>#include <stack>#include <iostream>#include <algorithm>using namespace std;typedef struct TreeNode{ int weight, K=0, child[99];} TreeNode;int N, M, S;TreeNode node[100];vector<vector<int>&...原创 2021-08-17 15:17:13 · 189 阅读 · 0 评论 -
1103 Integer Factorization (30 分)
#include <bits/stdc++.h>using namespace std;//FILE *p = fopen("file.txt", "w");int N, K, P, maxsum = 0, mintop = 20;stack<int> maxs, s;stack<int> tmps ,tmpmaxs;int up;void dfs(int cnt, int n, int sum, int ans){ if (n != 0) .原创 2021-08-13 22:22:11 · 110 阅读 · 0 评论 -
1093 Count PAT‘s (25 分)简单做法
1093 Count PAT's (25 分)The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now given any string, you are suppo...原创 2021-08-06 14:48:43 · 114 阅读 · 0 评论 -
1003 Emergency(25分)
#include<iostream>#include<vector>const int INT_MAX = 2147483647;typedef enum { UNDISCOVERED, VISITED }VStatus;//顶点状态,未访问和已访问template<typename Tv> struct Vertex {//城市 Tv data;//消防队的数量,即顶点的数据 VStatus status;//顶点状态 Verte...原创 2021-02-18 23:11:58 · 136 阅读 · 0 评论
分享