- 博客(23)
- 收藏
- 关注
翻译 1107. Social Clusters (30)
题目详情:https://www.patest.cn/contests/pat-a-practise/1107提交: 提交代码:#include <iostream>#include <vector>#include <algorithm>using namespace std;#define N 1010int hobby[N],likePerson[N];int n,isRoot[
2017-04-19 16:01:02 336
原创 1066. Root of AVL Tree (25)
题目详情:https://www.patest.cn/contests/pat-a-practise/1066提交:代码:#include <iostream>#include <malloc.h>using namespace std;#define N 22int n,number[N];typedef struct AVL{ int data,height; //heigh
2017-04-19 11:53:23 337
原创 1099. Build A Binary Search Tree (30)
题目详情: https://www.patest.cn/contests/pat-a-practise/1099提交:提交代码:#include <iostream>#include <algorithm>using namespace std;#define N 110typedef struct Node{ int data; int leftChild; in
2017-04-18 16:28:21 360
翻译 1064. Complete Binary Search Tree (30)
题目详情:https://www.patest.cn/contests/pat-a-practise/1064提交:代码:#include <iostream>#include <algorithm>using namespace std;#define N 1010int n,number[N],CBT[N],index = -1;void inOrder( int root ){
2017-04-18 15:10:17 435
原创 1043. Is It a Binary Search Tree (25)
题目详情:https://www.patest.cn/contests/pat-a-practise/1043提交: 提交代码:#include <iostream>#include <malloc.h>#include <vector>using namespace std;#define N 1010typedef struct BTree{ int data; s
2017-04-17 21:07:12 338
原创 1053. Path of Equal Weight (30)
题目详情:https://www.patest.cn/contests/pat-a-practise/1053提交: 提交代码:#include <iostream>#include <string.h>#include <vector>#include <algorithm>using namespace std;#define N 110#define INF 0x3f3f3f3f
2017-04-17 13:36:15 346
原创 1004. Counting Leaves (30)
题目详情:https://www.patest.cn/contests/pat-a-practise/1004提交情况:#include <iostream>#include <vector>#include <string.h>using namespace std;#define N 110vector<int> child[N];int n,m,Levels[N],maxLevel
2017-04-17 10:39:11 242
原创 1106. Lowest Price in Supply Chain (25)
题目详情:https://www.patest.cn/contests/pat-a-practise/1106提交情况:提交代码:#include <iostream>#include <string.h>#include <vector>#include <math.h>using namespace std;#define Max 100010#define INF 0x3f3f3f
2017-04-16 11:40:01 384
原创 1094. The Largest Generation (25)
题目详情:https://www.patest.cn/contests/pat-a-practise/1094提交情况: 提交代码:#include <iostream>#include <vector>using namespace std;#define Max 110int n,m,level[Max],maxLevel,visit[Max]; //level[Max]记录各节点的
2017-04-16 11:21:51 333
原创 1079. Total Sales of Supply Chain (25)
题目详情:https://www.patest.cn/contests/pat-a-practise/1079提交情况:代码:#include <iostream>#include <vector>#include <math.h> using namespace std;#define Max 100010//depths[]存储各节点的深度 //isRoot[]存储各个节点是否为根节
2017-04-16 09:54:48 355
原创 1090. Highest Price in Supply Chain (25)
题目信息: https://www.patest.cn/contests/pat-a-practise/1090提交情况: 提交代码:#include <iostream>#include <string.h>#include <vector>#include <math.h>#define Max 100010using namespace std;vector<int> child
2017-04-15 11:42:31 274
原创 1102. Invert a Binary Tree (25)
提交情况:代码:#include <iostream>#include <vector>#include <string.h>using namespace std;#define N 11typedef struct Node { int leftChild; int rightChild;}Node;Node node[N];int n,root[N];vec
2017-04-15 10:42:18 273
原创 1086. Tree Traversals Again (25)
提交情况:代码:#include <iostream>#include <string>#include <vector>#include <malloc.h>using namespace std;#define N 33#define INF 0x3f3f3f3fint number[N],top = -1,count,n;vector<int> num;typedef str
2017-04-14 15:41:55 360
原创 1020. Tree Traversals (25)
题目信息:https://www.patest.cn/contests/pat-a-practise/1020提交情况:代码:#include <iostream>#include <malloc.h>#include <vector>using namespace std;#define N 33typedef struct BTree{ int data; struc
2017-04-14 11:24:27 254
原创 1030. Travel Plan (30)
提交情况:代码:#include <iostream>#include <string.h>using namespace std;#define Max 505#define INF 0x3f3f3f3ftypedef struct Node{ int length; int cost;}Node;Node Graph[Max][Max];int n,m,s,d;
2017-04-14 10:02:18 326
原创 1003. Emergency (25)
提交情况: #include <iostream>#include <string.h>using namespace std;#define Max 510#define INF 0x3f3f3f3f //Graph为邻接矩阵存储图,weight为点权,w记录最短路径上的点权之和 int Graph[Max][Max],weight[Max],w[Max];//visit为访问数组
2017-04-09 12:42:29 392
原创 1076. Forwards on Weibo (30)
#include <iostream>#include <vector>#include <string.h> #define Max 1010using namespace std;vector<int> Graph[Max]; //用邻接表存储图 int queue[Max],front,rear; //队列
2017-04-08 17:39:30 268
原创 1034. Head of a Gang (30)
#include <iostream>#include <string>#include <map>using namespace std;#define Max 2010 //一开始我把Max定义为1010结果出现了段错误。后来突然想到n条通话记录最多可以有2*n个人进行通话。 //所以需要把Max设置为2000以上 map<string,int>
2017-04-08 11:30:04 280
原创 1021. Deepest Root (25)
算法思想:用并查集取得连通分量的个数。然后把每个节点都分别作为根节点,求得该节点作为根的树高 ,并保存在数组中。最后输出。 #include <iostream>#include <vector>#include <string.h>#include <algorithm>using namespace std;#define Max 10002vector<int> G[Max];
2017-04-07 15:45:21 269
原创 1013. Battle Over Cities (25)
#include <iostream>#include <string.h>using namespace std;#define MAX 1010int graph[MAX][MAX]; //邻接矩阵用于存储图 int check[MAX],visit[MAX],key,n,m,k;void DFS( int start );int main (){ int a,b;
2017-04-06 14:34:44 299
原创 1098. Insertion or Heap Sort (25)
只有部分正确,苦思凝想也没弄清楚剩下的那两分是什么地方没有考虑到,欢迎各位大神指点! #include <iostream>using namespace std;#define N 110int num[N],pSorted[N],n,hnum[N];bool isSame(int a[],int b[]){ for(int i=1;i<=n;++i) {
2017-04-04 11:53:57 407
原创 1001. A+B Format (20)
#include <iostream>using namespace std;int main (){ int a,b; int stack[10],top = -1; while(scanf("%d%d",&a,&b)!=EOF) { top = -1; int sum = a+b,count = 0; int
2017-04-01 11:34:56 454
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人