- 博客(240)
- 问答 (1)
- 收藏
- 关注
原创 MEI 论文笔记
Multi-Partition Embedding Interaction with Block Term Format for Knowledge Graph Completion
2022-12-05 16:08:45 725 2
原创 NePTuNe 论文笔记
NePTuNe:Neural Powered Tucker Network for Knowledge Graph Completion
2022-11-24 11:46:13 423 1
原创 PTransE 论文笔记
Modeling Relation Paths for Representation Learning of Knowledge Bases
2022-03-12 09:55:26 3211 13
原创 RESCAL 论文笔记
A Three-Way Model for Collective Learning on Multi-Relational Data
2022-03-12 09:37:58 2100
原创 DistMult 论文笔记
EMBEDDING ENTITIES AND RELATIONS FOR LEARNING AND INFERENCE IN KNOWLEDGE BASES
2022-03-10 13:05:58 5993
原创 TransR 论文笔记
Learning Entity and Relation Embeddings for Knowledge Graph Completion
2022-03-08 14:12:17 1432
原创 7-25 朋友圈 (25 分)【并查集】
#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define MANV 30005int parent[MANV];int find(int x){ if(parent[x]==x) return x; else{ parent[x]=find(parent[x]); return par
2021-04-25 17:35:28 139
原创 7-24 树种统计 (25 分)
AC代码:#include <iostream>#include <cstring>#include <algorithm>#include <map>using namespace std;int main(){ int n; cin>>n; cin.get(); string c; map<string,int> TIME; for(int i=0;i<n;i++
2021-04-25 11:58:23 222
原创 7-23 还原二叉树 (25 分)
方法一:#include <iostream>#include <cstring>#include <algorithm>using namespace std;char pre[51],in[51];int n;int fun(int t,int low,int high){ if(low>=high) return 1; else { int mid=0; for(int i=low
2021-04-25 11:15:56 107
原创 7-22 堆栈模拟队列 (25 分)
#include <iostream>#include <cstring>#include <algorithm>#include <stack>using namespace std;int main(){ int n1,n2,t; cin>>n1>>n2; if(n1>n2) swap(n1,n2); n1--; n2--; int s1[100],t
2021-04-24 20:48:19 122
原创 7-21 求前缀表达式的值 (25 分)
#include <iostream>#include <cstring>#include <algorithm>#include <stack>using namespace std;int main(){ char a[31]; cin.getline(a,31); stack<double> num; stack<char> sym; int len=strlen(a);
2021-04-24 13:13:56 99
原创 7-20 表达式转换 (25 分)【测试点说明】
代码:#include <iostream>#include <cstring>#include <algorithm>#include <stack>using namespace std;int level(char c){ if(c=='+'||c=='-') return 1; else return 2;}int main(){ char a[21]; cin>
2021-04-24 10:46:57 603
原创 7-17 汉诺塔的非递归实现 (25 分)
#include <iostream>#include <cstring>#include <algorithm>using namespace std;void fun(int n,char a,char b,char c){ if(n==1){ printf("%c -> %c\n",a,c); } else{ fun(n-1,a,c,b); printf("%c -> %c
2021-04-23 14:25:13 208
原创 7-14 电话聊天狂人 (25 分)
#include <iostream>#include <cstring>#include <algorithm>#include <map>using namespace std;int main(){ int n; cin>>n; map<string,int> TIME; string a,b,c; for(int i=0;i<n;i++){ cin>
2021-04-23 10:39:59 181
原创 7-11 关键活动 (30 分)
思路:拓扑排序+关键路径不知道为什么,和ac过的代码结果一致,但过不去。我怀疑是顺序的问题代码:#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define MAXN 105#define INF 1e9int G[MAXN][MAXN],n;int path[MAXN];int ve[MAXN]={0};int vl[MAXN];
2021-04-21 17:51:48 142
原创 7-10 公路村村通 (30 分)【最小生成树Prim算法】
#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define MAXN 1005#define INF 1e9int G[MAXN][MAXN],n;int cost[MAXN]; //元素为-1,表示已访问;为0表示成本为0(起始点)void Initialize(){ for(int i=1;i<=n;i++){
2021-04-20 15:54:58 224
原创 7-9 旅游规划 (25 分)
#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define MAXN 505#define INF 1e9int G[MAXN][MAXN]={0},P[MAXN][MAXN]={0},n;int dist[MAXN]={0};int vis[MAXN]={0};int cost[MAXN];void create(){ for(i
2021-04-20 14:17:00 168
原创 7-8 哈利·波特的考试 (25 分)
思路:一开始根本没看懂题目,看了其他代码后才知道。首先通过Floyd算法求得任意两个结点之间的最短距离。对于某个结点,遍历其与其他结点的最大距离,得到该结点到其他结点的最大最短路径。求得所有结点的最大最短路径。(找到最难变的那种动物)在所有的最大最短路径中找到最小值即为解。(魔咒最短)代码:#include <iostream>#include <algorithm>using namespace std;#define MAXN 105#define I
2021-04-20 10:09:54 119
原创 7-7 六度空间 (30 分)
思路:对每个顶点使用BFS的方法记录当前原点到其他点的距离代码:#include <iostream>#include <cstring>#include <algorithm>using namespace std;#define INF 1e9#define MAXN 1005int G[MAXN][MAXN]={0};int vis[MAXN]={0};int dist[MAXN];int BFS(int v,int n){ in
2021-04-19 16:55:29 283
原创 7-6 列出连通集 (25 分)
#include <iostream>#include <algorithm>#include <cstring>using namespace std;#define MAXN 10int G[MAXN][MAXN]={0},n;int vis[MAXN]={0};void DFS(int v){ vis[v]=1; cout<<v<<" "; for(int i=0;i<n;i++){
2021-04-19 14:00:57 79
原创 7-5 堆中的路径 (25 分)
小根堆结点的插入:#include <iostream>#include <algorithm>using namespace std;void UpAdjus(int *a,int n){ int temp=a[n],i;// cout<<temp<<endl; for(i=n;temp<a[i/2]&&i>1;i/=2){ a[i]=a[i/2]; } a[i]=
2021-04-19 13:24:02 120
原创 7-4 是否同一棵二叉搜索树 (25 分)
#include <iostream>#include <algorithm>using namespace std;typedef struct TreeNode{ struct TreeNode *left,*right; int data;}TreeNode, *Tree;Tree insert(Tree T,int x){ if(T==NULL){ T=(Tree)malloc(sizeof(struct TreeNode
2021-04-19 12:21:48 83
原创 7-3 树的同构 (25 分)
思路:https://www.cnblogs.com/yuxiaoba/p/8329986.html代码:#include <iostream>#define Tree intusing namespace std;typedef struct TreeNode{ Tree left,right; char data;}TreeNode;TreeNode T1[10],T2[10];Tree BuildTree(struct TreeNode T[]){
2021-04-19 11:46:50 86
原创 7-2 一元多项式的乘法与加法运算 (20 分)
#include <iostream>#include <stack>#include <map>#include <algorithm>using namespace std;typedef struct{ int n,x;}num;bool cmp(num a,num b){ if(a.x>b.x) return 1; return 0;}int main(){ int an[200
2021-04-18 16:29:02 61
原创 7-1 最大子列和问题 (20 分)
#include <iostream>#include <algorithm>using namespace std;int a[100005];int dp[100005];int fun(int n){ if(n==0) return a[0]; else{ return max(fun(n-1)+a[n],a[n]); }}int main(){ int n; cin>>n;
2021-04-18 11:37:31 59
原创 6-2 Two Stacks In One Array (20 分)
Stack CreateStack( int MaxElements ){ Stack s=malloc(sizeof (struct StackRecord)); s->Array=(int *)malloc(MaxElements*(sizeof (int))); s->Capacity=MaxElements; s->Top1=-1; s->Top2=s->Capacity; return s;}int IsEmpty(
2021-04-18 11:07:42 155
原创 6-1 Deque (25 分)
Deque CreateDeque(){ PtrToNode head = malloc(sizeof(struct Node)); head->Next=head->Last=NULL; Deque D=malloc(sizeof (struct DequeRecord)); D->Front=D->Rear=head; return D;}int Push( ElementType X, Deque D ){ PtrToNode
2021-04-18 10:36:41 292
原创 6-17 Shortest Path [4] (25 分)
void ShortestDist( MGraph Graph, int dist[], int path[], Vertex S ){ int vis[MaxVertexNum]={0},n=Graph->Nv; for(int i=0;i<n;i++){ dist[i]=INFINITY; path[i]=-1; } dist[S]=0; for(int i=0;i<n;i++){ int min=
2021-04-17 11:47:23 132
原创 6-16 Shortest Path [3] (25 分)
void ShortestDist( MGraph Graph, int dist[], int count[], Vertex S ){ int vis[MaxVertexNum]={0},n=Graph->Nv; for(int i=0;i<n;i++){ dist[i]=Graph->G[S][i]; count[i]=0; } //vis[S]=1; dist[S]=0; count[S]=1;
2021-04-17 11:21:19 258
原创 习题4.3 是否二叉搜索树 (25 分)
int pre=-1e9;bool IsBST ( BinTree T ){ if(!T) return true; else{ IsBST(T->Left); if(T->Data<pre) return false; else pre=T->Data; IsBST(T->Right); return true;
2021-04-17 09:46:28 128
原创 6-15 Iterative Mergesort (25 分)
void merge_pass( ElementType list[], ElementType sorted[], int N, int length ){ int h1=0,e1=length-1,h2=length,e2=2*length-1; //h1、h2分别是两个归并数组的开头,e1、e2是结尾 int k=0,last=0; while(1){// printf("%d %d - %d %d\n",h1,e1,h2,e2); if(e2&
2021-04-16 23:27:45 213
原创 6-14 Count Connected Components (20 分)
int vis[MaxVertexNum]={0};void DFS(LGraph Graph,int v){ vis[v]=1; PtrToAdjVNode p=Graph->G[v].FirstEdge; while(p){ if(vis[p->AdjV]==0){ DFS(Graph,p->AdjV); } p=p->Next; }}int CountConnecte
2021-04-16 16:12:40 221
原创 6-13 Topological Sort (25 分)【拓扑排序】
代码:bool TopSort( LGraph Graph, Vertex TopOrder[] ){ int k=0,n=Graph->Nv,v; PtrToAdjVNode p; int stack[MaxVertexNum],top=-1; int inDegree[MaxVertexNum]={0}; for(int i=0;i<n;i++){ //统计入度 p=Graph->G[i].FirstEdge;
2021-04-16 14:31:44 244
原创 6-12 Shortest Path [2] (25 分)【单元最短路径 - 迪杰斯特拉】
void ShortestDist( MGraph Graph, int dist[], Vertex S ){ int n=Graph->Nv; for(int i=0;i<n;i++){ dist[i]=Graph->G[S][i]; } int vis[MaxVertexNum]={0}; vis[S]=1; dist[S]=0; int min,v; for(int i=0;i<n;i++){
2021-04-16 13:30:55 207
空空如也
谁知道如何使用java同步打乱多个数组
2022-06-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人