- 博客(20)
- 收藏
- 关注
原创 数据结构实验 7-15 航空公司VIP客户查询 (25分)
#include<bits/stdc++.h> using namespace std; int n, k, cnt = 0; const int mod = 1e5+7; int head[mod]; struct Node{ char name[20]; int sc, next; Node(){ sc = 0; } }p[mod]; int Hash(char* s){ int hs = 0, i; for( i = 0.
2020-12-22 07:43:32
1000
2
原创 数据结构实验 7-17 字符串关键字的散列映射 (25分)
#include<bits/stdc++.h> using namespace std; const int maxn = 1100; int vis[maxn], sc[maxn]; int n, p; struct Node{ int hs; char s[10]; }t[maxn]; int Hash(char *s){ int l = strlen(s), hs = 0, q = 1; if(l>3){ for(int i =.
2020-12-22 07:43:18
473
原创 数据结构实验 7-18 新浪微博热门话题 (30分)
#include<bits/stdc++.h> using namespace std; int n; char ch, inp[155]; int ans = 0, coun = 0; char topic[155]; map<string, int> mp;//用于记录话题 int main(){ scanf("%d",&n);getchar(); for(int i = 0; i < n; i++){ int flag = 0.
2020-12-22 07:43:04
487
原创 数据结构实验 7-19 寻找大富翁 (25分)
#include<bits/stdc++.h> using namespace std; const int maxn = 1e6+10; int inp[maxn]; int n, m, value, l, r; void heapAjust(int head, int tail){ value = inp[head]; l = 2*head; r = 2*head+1; int id;//较大的孩子 while(l<=tail){ .
2020-12-22 07:42:44
596
原创 数据结构实验 7-20 奥运排行榜 (25分)
#include<bits/stdc++.h> using namespace std; struct country{ int id; double gold, medal, people; double avrgold, avrmedal; }c[230]; int ids[230][5]; void Qsort( int low, int high, bool (*cmp)(country, country)){ if( !(low<high).
2020-12-22 07:42:21
1028
原创 数据结构实验 7-21 PAT排名汇总 (25分)
#include<bits/stdc++.h> using namespace std; struct student{ char num[15]; int id; int grade; int ranks; int idrank; bool operator > (student a) { if(a.grade == grade){ return strcmp(num, a.num)<0;.
2020-12-22 07:41:36
778
原创 数据结构实验 7-22 模拟EXCEL排序 (25分)
#include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, c; struct student{ char num[10]; char name[10]; int grade; }stu[maxn]; void heapAjust(int head, int tail, bool (*cmp)(student, student)){ student value.
2020-12-22 07:41:01
744
原创 数据结构实验 7-7 Windows消息队列 (25分)
#include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, id, cnt = 0; struct infonode { char name[15]; int priority; bool operator < (const infonode &a) const{ return priority > a.priority; } .
2020-12-22 07:40:45
238
原创 数据结构实验 7-13 畅通工程之局部最小花费问题 (35分)
#include<bits/stdc++.h> using namespace std; const int maxn = 100; int pre[105]; int n, m; struct Node{ int u, v, cost; bool operator >= (Node a){ return cost >= a.cost; } bool operator <= (Node a){ return c
2020-12-22 07:40:22
385
原创 数据结构实验 7-12 社交网络图中结点的“重要性”计算 (30分)
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f const int maxn = 1e4+10; int dis[maxn][maxn]; int n, m; void floyd(){ for(int k = 1; k <= n; k++){ for(int i = 1; i <= n; i++){ for(int j = 1; j <=
2020-12-21 10:16:42
652
原创 数据结构实验 7-11 公路村村通 (30分)
#include<bits/stdc++.h> using namespace std; const int maxn = 1005; int pre[1005]; int n, m; struct Node{ int u, v, w; bool operator <= (const Node x){ return w <= x.w; } bool operator >= (const Node x){ ret
2020-12-21 10:15:52
529
原创 数据结构实验 7-10 旅游规划 (25分)
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f const int maxn = 505; int length[maxn][maxn]; int dis[maxn], pre[maxn], vis[maxn], sum[maxn], cost[maxn][maxn]; typedef struct { int vexnum, edgenum; int matrix[maxn][maxn]
2020-12-21 10:14:47
662
原创 数据结构实验 7-8 修理牧场 (25分)
裸哈夫曼 #include<bits/stdc++.h> using namespace std; //哈夫曼算法 priority_queue<int, vector<int>, greater<int> > pq; int n, l, ans = 0; int main(){ scanf("%d",&n); while(n--){ scanf("%d",&l); pq.push(l);
2020-12-21 10:12:22
592
原创 数据结构实验 7-5 银行排队问题之单队列多窗口服务 (25分)
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f const int maxn = 1005; int cnt[maxn]; int Left[maxn];//每个窗口 最后一个人离开的时间 struct Node{ int arr, prc;//到达时间 事务处理时间 }p[maxn]; int main(){ int n, k; int tmp, mx = 0, sum
2020-12-21 10:09:54
877
原创 数据结构实验 7-3 银行业务队列简单模拟 (25分)
#include<bits/stdc++.h> using namespace std; //函数状态码定义 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 typedef int Status; typedef int QElemType; //假设线性表中的元素均为整型
2020-12-21 10:06:39
2160
原创 数据结构实验 7-2 一元多项式求导 (20分)
结构体存储多项式 #include<bits/stdc++.h> using namespace std; //函数状态码定义 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 struct Polynomial{//多项式 int cof, ind;//系数 指数 };
2020-12-21 10:05:02
1630
原创 数据结构实验 7-1 一元多项式的乘法与加法运算 (20 分)
多项式最好用结构体储存,并进行处理。 #include<bits/stdc++.h> using namespace std; //函数状态码定义 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 struct Polynomial{//多项式 int cof, ind;//系数 指数
2020-12-21 07:37:47
778
原创 Codeforces 1321
B 思维题 题解:对于某个满足题意的序列来说 其元素的值与其序号的差值x相等 如样例1中的 a2 = 7, a4 = 9, a5 = 10; x值均为5 注意若通过数组储存 下标(即x)会出现负值 所以需要将输入均加上一个较大的值 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5+10; int n; int b[maxn], a[maxn]; ll sm[100001
2020-10-06 21:38:08
156
原创 2019 ICPC NAC补题
题目链接(PDF):https://cs.baylor.edu/~hamerly/icpc/qualifier_2019/naq2019.pdf B 体会:若题干没有明确具体形式, 就按照最容易的形式计算,如本题,将每个小矩形按照正方形处理 题解:若当做正方形处理,则只需要看直线y = M/Nx ((0,0)->(N,M)) 是否经过正方形中心点即可。 正方形的左下角的点设为(p,q) 则其中心的点为(p+1/2, q+1/2) 即是否满足q+1/2 = M/N(p + 1/2) 约分后得 2q+1
2020-10-05 23:04:05
464
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人