自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 资源 (3)
  • 收藏
  • 关注

原创 在Ubuntu的Hadoop&Hbase安装和使用(超详细)

以下安装链接和流程本人亲身使用过,能够成功安装,详细度足够。Hadoop各版本下载Hbase各版本下载Hadoop安装及伪分布式配置注意:该博文的3.1的yarn-site.xml的最后一个<configuraion>需要结束标志,即改为</configuration>。yarn-site.xml应更正为以下文件:<configuration> <!--nodeManager获取数据的方式是shuffle--> <prop

2022-04-04 09:24:52 316

原创 时限调度算法(python实现)(最早截止时间优先)2021-10-15

效果如图:可以自己更改参数玩玩,看看对多个进程每个进程是否公平,理论上多少个进程都无所谓,不过具体参数的自己调,基本都封装好了#ps_schedulingimport numpy as npimport matplotlib.pyplot as pltimport mpl_toolkits.axisartist as axisartistclass PS(object): def __init__(self,Fin,Exe,Height,Havedone=0): se

2021-10-15 12:30:45 906

原创 1147 Heaps (30 分)

#include <cstdio>using namespace std;const int maxn=1020;int N,M;int level[maxn];bool isMax(int root){ if(root*2>N){ return true; } if(root*2+1>N) return level[root]>=level[root*2]; int t=(level[root*2]>leve

2021-09-10 11:44:38 68

原创 1140 Look-and-say Sequence

#include <iostream>#include <string>using namespace std;int main(void){ string str,tstr; int Time; cin>>str>>Time; if(Time==1){ cout<<str; return 0; } for(int i=2;i<=Time;i++){

2021-09-10 09:47:17 68

原创 进阶实验4-3.5 哈夫曼编码 (30 分)

仅供参考#include <iostream>#include <cstdio>#include <queue>#include <string>#include <map>using namespace std;const int maxn=10002;int N;priority_queue<int,vector<int>,greater<int> > q;struct node{

2021-09-04 22:28:27 187

原创 进阶实验4-3.4 笛卡尔树 (25 分)

实验书后没找到读者验证码,本程序仅在本地验证#include <cstdio>using namespace std;const int maxn=1010;struct node{ int k1,k2,left,right;}Tree[maxn];int N;bool isBST(int root){ if(root==-1) return true; bool f1,f2; f1=f2=true; if(Tree[root].left

2021-09-04 09:48:33 113

原创 19年PAT甲级春季题解

7-1 Sexy Primes#include <cstdio>#include <cmath>using namespace std;bool isPrime(int n){ if(n<=1) return false; int sqr=(int)sqrt(1.0*n); for(int i=2;i<=sqr;i++) if(n%i==0) return false; return true;}bool i

2021-08-25 18:49:17 86

原创 1105 Spiral Matrix

简单模拟题#include <cstdio>#include <algorithm>#include <cmath>using namespace std;int N;const int maxn=10020;const int INF=10000000;int num[maxn];bool cmp(int a,int b){ return a>b;}int main(void){ scanf("%d",&N);

2021-08-22 12:10:30 48

原创 1017 Queueing at Bank

注意点:客户迟到和早到所带来的影响,后面三个测试点不过的原因在这。#include <cstdio>#include <algorithm>using namespace std;const int INF=1000000;const int maxn=10010;int Window[200];struct customer{ int arrive_time,process_time,wait_time;//s为单位}Cus[maxn];int cor[

2021-08-22 10:49:17 64

原创 1069 The Black Hole of Numbers

注意此组测试数据:#include <cstdio>#include <algorithm>using namespace std;int num[10];bool cmp(int a,int b){ return a>b;}void divide(int n){ for(int i=3;i>=0;i--){ num[i]=n%10; n/=10; }}int merge(){ i

2021-08-21 17:14:57 50

原创 1088 Rational Arithmetic (20 分)

#include <cstdio>#include <algorithm>using namespace std;struct Fraction{ long int up,down;};long int gcd(long int a,long int b){ if(b==0) return a; return gcd(b,a%b);}Fraction reduction(Fraction a){ if(a.down<0){

2021-08-21 16:32:05 57

原创 PAT(甲级)2014年冬季考试 Insert or Merge

其中step/2<N的意思是step/2=N-1的时候,此时左半边包括了整个数组,确保整个数组都整合有序#include <cstdio>#include <algorithm>using namespace std;const int maxn =110;int initiate[maxn];int tmp[maxn];int target[maxn];int pos,N;bool isInsertionSort(){ for(int i=1;i

2021-08-21 15:06:21 54

原创 1014 Waiting in Line 简单队列模拟题

#include <cstdio>#include <queue>#include <algorithm>using namespace std;const int maxn=1010;struct window{ int endtime; int poptime; queue<int> q;}Window[21];int ans[maxn];int needtime[maxn];int N,M,K,Q;int i

2021-08-19 21:04:21 45

原创 1023 Have Fun with Numbers (20 分)

建议使用结构体引用或指针作为函数传递参数。#include <cstdio>#include <cstring>#include <algorithm>using namespace std;struct bign{ int d[1000]; int len; bign(){ memset(d,0,sizeof(d)); len=0; }};void change(char str[],bi

2021-08-19 09:22:33 43

原创 1104 Sum of Number Segments PAT (Advanced Level) Practice

排列组合题:对给定序列中任一个数,讨论该数在给定序列对应的所有连续序列中出现的次数,将该次数乘以该数得出该数对总和的贡献。遍历给定序列中每一个数,统计贡献即得总和。对于次数求法,该数两边可能情况数相乘即可(记得统计可能为空的情况)。例如,本题中的序列{ 0.1, 0.2, 0.3, 0.4 },对0.3来讲,左边可能情况为() (0.1) (0.1, 0.2),情况数为3,右边可能情况为() (0.4),情况数为2。显然可发现,对0.3来讲,任一边情况数=0.3对应边数字的个数+1;因此,将该规律抽象出来即

2021-08-18 11:28:09 59

原创 1042 Shuffling Machine (20 分) PAT (Advanced Level) Practice

#include <cstdio>using namespace std;const int size=55;char mp[]={'S','H','C','D','J'};int start[size];int end[size];int order[size];int k;int main(void){ scanf("%d",&k); for(int i=1;i<=size-1;i++){ scanf("%d",&or

2021-08-16 21:59:36 47

原创 1046 Shortest Distance PAT (Advanced Level) Practice

#include <cstdio>#include <algorithm>using namespace std;const int maxn=100010;int d[maxn],N;int main(void){ scanf("%d",&N); for(int i=1;i<=N;i++){ int dis; scanf("%d",&dis); d[i]=d[i-1]+dis;

2021-08-16 21:00:52 54

原创 PAT (Advanced Level) Practice 1070 Mooncake (25 分)

1070 Mooncake (25 分)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture. Now given the inventory amounts and the

2021-08-13 18:46:34 52

原创 PAT (Advanced Level) Practice1084 Broken Keyboard

不用哈希表,直接用string里一些性质就完#include <string>#include <iostream>using namespace std;int main(void){ string s1,s2,S; cin >> s1>>s2; for(string::iterator it=s2.begin();it!=s2.end();it++){ if(*it>='a' && *it<='z'){

2021-08-12 20:28:35 51

原创 PAT (Advanced Level) Practice 1012 The Best Rank 论如何把代码写成自己逐渐看不懂得样子

1012 The Best Rank (25 分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we enc

2021-08-12 17:52:57 46

原创 PAT (Advanced Level) Practice 1097 Deduplication on a Linked List

#include <cstdio>#include <algorithm>using namespace std;const int maxn=10010;const int Max=100010;bool vis[maxn]={false};struct node{ int address,data,next,order;}list[Max];int N,head;bool cmp(node a, node b){ return a.order<b.

2021-08-08 09:29:05 60

原创 PAT 1051 Pop Sequence

#include <cstdio>#include <stack>using namespace std;const int maxn=1001;stack<int> s;int index;int M,N,k;int xulie[maxn];int main(void){ scanf("%d%d%d",&M,&N,&k); for(int i=1;i<=k;i++){ for(int j=1;j<=N;j+

2021-08-08 08:22:18 49

原创 PAT 1074 Reversing Linked List

模板题。注意:题目给的结点不一定全能用上。第六个测试点出现错误的,建议检查一下有效结点找的是否准确(比如说个数啊之类的,我就是一开始错在个数上)。#include <cstdio>#include <algorithm>using namespace std;const int maxn=100010;struct node{ int address,data,next,order;}list[maxn];int head,N,k;bool cmp(nod

2021-08-07 17:52:29 70

原创 算法笔记胡凡 7.3.4 连接各点时代码有误

在此书7.3.4中,静态链表结点定义如下:struct Node{ typename data; int next;}node[size];书中要将11111,22222,33333三个地方的节点连接写成:node[11111] = 22222;node[22222] = 33333;node[33333] = -1;显然有误。应为:node[11111].next = 22222;node[22222].next = 33333;node[33333].next = -1;

2021-08-06 10:50:05 55

原创 PAT A1053

#include <cstdio>#include <cstring>#include <algorithm>#include <vector>using namespace std;const int maxn=110;int N,M,S;int w[maxn];vector<int> Adj[maxn];vector<int> path; int W;void DFS(int i){ if(Adj[i].

2021-08-03 09:16:06 34

原创 PAT (Advanced Level) Practice 1021 Deepest Root (25 分)

#include <cstdio>#include <cstring>#include <vector>#include <set>#include <queue>using namespace std;const int maxn=10010;vector<int> Adj[maxn];int N;set<int> droot;bool vis[maxn];bool inq[maxn];int e

2021-07-31 18:09:48 61

原创 1030 Travel Plan

1030 Travel Plan优化《算法笔记》的算法,添加剪枝#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn=501;const int INF=100000000;int N,M,S,D;int G[maxn][maxn];int cost[maxn][maxn];i

2021-07-29 11:02:37 50

原创 03-树2 List Leaves

思路:通过队列进行数据处理。#include <stdio.h>#include <stdlib.h>#define Maxsize 10typedef struct tree* Tree;typedef struct node* Node;struct node{ int left; int right;};struct tree{ int head; Node TREE;};Tree Read();void Find(Tree A);int

2020-07-03 20:44:50 60

原创 03-树1 树的同构

#include <stdio.h>#include <stdlib.h>#define Null -1typedef struct tree* Tree;typedef struct node* Node;struct tree{ int head; Node TREE;};struct node{ char Letter; int left; int Right;};Tree Read(int N);int IF(Tree A, Tree B);

2020-07-02 23:32:43 115

原创 01-复杂度2 Maximum Subsequence Sum

做这道题的时候有点头昏脑胀,代码可能有的地方比较多余,望谅解。#include <stdio.h>int main(int argc, char *argv[]) { int i,ofirst,last,nfirst,K,n,sum=0,move=0,flag=1,flag2=1,extremeF,extremeL,cnt=0; scanf("%d",&K); for(i=0;i<K;i++){ scanf("%d",&n); move+=n;

2020-06-29 18:21:19 80

原创 02-线性结构4 Pop Sequence

**## 堆栈模拟**思路:做堆栈去模拟目标序列(即带检查序列)的产生。1.建立两个堆栈,一个为输入stack,提供输入值;一个为检查stack,负责检验目标值(即读入值);2.判断第一个是否大于stack的容量,是则继续,否则不断push直到目标值为止,并抛出目标值;3.开始进入循环,当两个stack都空时为止,循环中对每一个读进来的目标值进行一些分类;4.释放空间,返回1;#include <stdio.h>#include <stdlib.h>

2020-06-29 14:51:13 190

原创 Reversing Linked List

下面展示一些 内联代码片。// A code blockvar foo = 'bar';#include <stdio.h>#include <stdlib.h>#define ElementType int#define Maxsize 100000typedef struct node Node;typedef struct list* List;struct node{ ElementType Data; int Next;};struct lis

2020-06-27 11:20:20 67

原创 02-线性结构2 一元多项式的乘法与加法运算

下面展示一些 内联代码片。// 鄙人不才,花了一整天才写完。通过PAT那一刻涕泪交加,特写博客纪念。代码或许冗余,仅供各位大佬们娱乐一下。代码是从Dev直接复制粘贴过来的,排版可能不是那么的好看。本人用数组写的,非链表实现。有不足的地方望能海涵指正。希望各位看官看完点个赞。举手之劳,却是我今后继续创作的最大激励。谢谢!#include <stdio.h>#include <stdlib.h> #define ElementType inttypedef st

2020-06-24 15:56:17 101

原创 习题2.5 两个有序链表序列的合并 (15分)

习题2.5 两个有序链表序列的合并 (15分)List Merge( List L1, List L2 ){ List L1move=L1,L2move=L2->Next; if(!L1) return L2; if(!L2) return L1; while(L1move->Next && L2move){ List L2set; while(L1move->Next && L2move && L1move->Nex

2020-06-20 15:40:32 366

《Java Web程序设计任务教程》配套资源.zip

仅供用户个人学习、研究、技术交流等非营业性使用

2022-01-25

《Spring Boot企业级开发教程》配套资源.zip

仅供用户个人学习、研究、技术交流等非营业性使用

2022-01-25

《Java EE企业级应用开发教程(Spring+Spring MVC+MyBatis)》配套资源.zip

仅供用户个人学习、研究、技术交流等非营业性使用

2022-01-25

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除