- 博客(44)
- 问答 (3)
- 收藏
- 关注
原创 第四题 解析式表达式 北邮机试
用双栈实现表达式,与之前不同的是加入了单目运算符,用c++实现可能麻烦了些。当然,我写的不一定全部样例都过,发现还请指正。
2023-02-20 19:49:40
228
原创 实战Kaggle比赛:预测房价
https://www.kaggle.com/competitions/house-prices-advanced-regression-techniques/
2023-02-12 20:35:59
219
原创 Anaconda pip xgboost 和 lightgbm 出现 ModuleNotFoundError
使用 xgboost和lightbm
2022-09-01 17:34:45
373
1
原创 中缀表达式转后缀表达式-栈实现简单的计算器功能
主要思路来自于本文是随便写的没什么很逻辑的结构,不同的人根据不同的中缀表达式写的不太一样,但是利用同样的计算方法结果相同,大概是数相加或者相减的顺序不同。此代码没有经过很多数据的测试,可能某些条件没写好,很可能有bug,发现时还望在评论区留言共同进步。/** * 用链表实现的栈; * */public class LinkedStack { class StackNode { public Object o = null; public StackNode
2021-08-11 18:40:40
156
原创 最小重量零件问题----分支限界法
#include<bits/stdc++.h>using namespace std;int part_n = 3;int service_m = 3;int max_value = 4;double **value_information;double *least_value;double **weight_information;double *least_weight;vector<int> Best_solution;double Best_weigh
2020-12-30 16:44:00
400
原创 旅行售货商问题----分支限界法(非优先队列)
#include<bits/stdc++.h>#include<queue>using namespace std;const int point_number = 4;///顶点个数double **Distance;///距离矩阵double Best_length = 1000000;///最优距离(开始时取较大值)vector<int> Best_solution;///最优解class Node{///结点public: double _
2020-12-23 20:11:52
376
原创 2020-12-21
#include <iostream>#include <algorithm>#include <iomanip>using namespace std;typedef struct Thing{ double weight; double value; int index;};Thing *things;const int goods = 7;//物品的数量int Max_Weigth = 150;//背包承受的重量int
2020-12-21 19:14:54
96
原创 旅行售货商问题----回溯法
#include <iostream>using namespace std;const int Inf = 10000000;//定义一个比较大的值const int number = 12;//度int information[2][number] = {{1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4}, {2, 3, 4, 1, 3, 4, 1, 2, 4, 1, 2, 3}};//边double Distance[number] = {30, 6, 4.
2020-12-20 19:34:08
370
原创 图的m着色问题----回溯法解决
#include <iostream>#include <algorithm>#include <iomanip>using namespace std;int information[2][22] = {{1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7}, {2, 6, 7, 1, 7, 3, 2, 7, 4, 6, 3, 5, 6, 4, 5, 4, 7, 1, 6, 1, 2
2020-12-19 20:39:57
318
2
原创 回溯法解决0-1背包问题----迭代
#include <iostream>#include <algorithm>#include <iomanip>using namespace std;typedef struct Thing{ double weight; double value; int index;};Thing *things;const int goods = 7;//物品的数量int Max_Weigth = 150;//背包承受的重量int
2020-12-19 16:23:50
806
3
原创 回溯法解决0-1背包问题----递归
#include <iostream>#include <algorithm>#include <iomanip>using namespace std;typedef struct Thing{ double weight; double value; int index;};Thing *things;const int goods = 7;//物品的数量int Max_Weigth = 150;//背包承受的重量int
2020-12-16 19:36:43
363
3
原创 虚拟汽车加油问题
#include<iostream>using namespace std;int main(){ int drive;// 汽车加满油后走长度 int gas_number; // 加油站数 int *gas_pos, get_oil = 0; cin >> drive >> gas_number; gas_number++; gas_pos = new int[gas_number]; for(int
2020-12-14 22:00:43
303
原创 实现哈夫曼编码
#include<iostream>#include<algorithm>#include<set>#include <queue>#include<string>using namespace std;typedef struct Node{ string name; int is; int value; Node* left; Node* right;};vector<Nod
2020-12-14 17:34:55
216
原创 7-3 冒泡法排序 (20分)
复习用#include<iostream>using namespace std;int main(){ int *array; int n, m; scanf("%d %d", &n, &m); array = new int[n+1]; for(int i = 0; i < n; i++) scanf("%d", &array[i]); for(int i = 0; i < m; i+
2020-12-11 17:56:11
798
原创 7-2 一元多项式的乘法与加法运算 (20分)
7-2 一元多项式的乘法与加法运算 (20分)设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。零多项式应输出0 0。输入样例:4 3 4 -5 2 6 1 -2 03 5 20 -7 4 3 1输出样例:15
2020-12-11 17:25:24
86
原创 简单的字符串匹配
#include <iostream>using namespace std;int Find_str(char *str, char *s){ char *first = str, *second = s; while(*first != '\0') { cout << *first << " " << *second << endl; if(*first == *second)
2020-12-10 21:39:32
153
原创 快速排序
#include <iostream>using namespace std;int Partition(int *array, int start, int finish){ int key = array[start]; while(start < finish) { while(start < finish && array[finish] > key) finish--; array[st
2020-12-10 21:21:03
81
原创 独立任务最优调度问题-动态规划解决
问题描述:用2台处理机A和B处理n个作业。设第i个作业交给机器A处理时需要时间ai,若由机器B来处理,则需要时间bi。由于各作业的特点和机器的性能关系,很可能对于某些i,有ai>bi,而对于某些j,j≠i,有aj>bj。既不能将一个作业分开由2台机器处理,也没有一台机器能同时处理2个作业。设计一个动态规划算法,使得这2台机器处理完这n个作业的时间最短(从任何一台机器开工到最后一台机器停工的总时间)。研究一个实例:(a1,a2,a3,a4,a5,a6)=(2,5,7,10,5,2);(b1,b
2020-12-09 20:43:56
1962
2
原创 0-1背包问题的动态规划解决问题
#include <iostream>#include <time.h>#include <algorithm>#include <iomanip>using namespace std;const int goods = 5;//物品的数量int Max_Weigth = 10;//背包承受的重量int information[2][goods] = {{2, 2, 6, 5, 4}, {6, 3, 5, 4, 6}};//第一行为重量,第二
2020-11-30 20:42:29
166
原创 实现分治法求解棋盘覆盖问题
#include <iostream>#include <time.h>#include <algorithm>#include <iomanip>int **chess;using namespace std;int flag = 1;void Init_Chess(int x){ chess = new int*[x + 2]; for(int i = 0; i < x + 2; i++) {
2020-11-28 21:39:44
410
原创 二分搜索算法的实现
#include <iostream>#include <time.h>#include <algorithm>//二分法的递归实现using namespace std;int Recursion(int *list, int left, int right, int value){ if(left > right) return -1; int min_pos = (left + right) / 2; if(
2020-11-28 19:38:36
266
原创 7-11 公路村村通 (30分)
#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;typedef struct Hamlet{ int is_true; int parent; int pay;};Hamlet *citys;int ** data;void Init_citys_data(int N){ for(int i = 0; i < N + 2; i++) {
2020-11-23 17:16:42
271
原创 简单的背包问题
给定8个物品,其重量和价值如下图的表所示,现在从这些物品中挑出总重量不超过100的物品,编写程序求解所有方案中价值总和的最大值#include <iostream>#include <cstdlib>#include <ctime>#include<cmath>#include<vector>#include <fstream>#include<algorithm>using namespace std;
2020-11-23 17:14:56
490
1
原创 7-10 旅游规划 (25分)
#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;typedef struct City{ int is_true;//是否加入序列 int len;//初点到每个城市的长度 int pay;//初点到每个城市的费用;};typedef struct Data // 用矩阵表示每个城市之间的距离和费用{ int len; int pay;};City *c
2020-11-22 21:48:29
450
原创 7-8 修理牧场 (25分)
#include<bits/stdc++.h>using namespace std;int find_min(vector<int> &part, int x){ for(int i = part.size()-1; i >= 0; i--) { if(x <= part[i]) return i; } return 0;}int main(){ int N, x, su
2020-11-22 21:48:00
441
原创 7-7 Windows消息队列 (25分)
#include<bits/stdc++.h>using namespace std;typedef struct LNode{ int data; char name[12]; struct LNode *next; bool operator < (const LNode & a) const { return data > a.data; }} LNode;priority_queue <L
2020-11-22 21:47:16
334
原创 7-6 银行排队问题之单队列多窗口加VIP服务 (30分)
#include <algorithm>#include<iostream>#include<bits/stdc++.h>using namespace std;struct List{ int start_time;//头指针计总分等待时间 int end_time;//头指针计最长等待时间 int wait_time;//代表服务了多少人 int VIP;//队列头表示是否为VIP序列 struct List *nex
2020-11-22 21:46:15
738
原创 7-3 银行业务队列简单模拟 (25分)
num = input()num_list = num.split(" ")for i in range(0, len(num_list)): num_list[i] = int(num_list[i])List, List1, List2 = [], [], []Range = num_list.pop(0)j = 0for i in num_list: if i % 2 == 1: List1.append(i) if i % 2 == 0:
2020-11-22 21:44:16
1013
原创 7-5 银行排队问题之单队列多窗口服务 (25分)
#include <algorithm>#include<iostream>using namespace std;struct List{ int start_time;//头指针计总分等待时间 int end_time;//头指针计最长等待时间 int wait_time;//代表服务了多少人 struct List *next;};void Insert_List(List *head, List *tail, List *L){.
2020-11-22 21:41:48
387
原创 7-5 关键活动 (30分)
#include<iostream>#include<vector>#include<bits/stdc++.h>#define Inf 100000//176869649562//2220554042using namespace std;typedef struct City{ int length;};typedef struct Path_Store{ int start; int finish;};int pa.
2020-11-22 18:35:06
124
原创 7-11 公路村村通 (30分)
#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;typedef struct Hamlet{ int is_true; int parent; int pay;};Hamlet *citys;int ** data;void Init_citys_data(int N){ for(int i = 0; i < N + 2; i++) { .
2020-11-22 18:33:30
122
原创 7-16 新浪微博热门话题 (30分)
#include<bits/stdc++.h>using namespace std;map<string, int> topics;int Max = 0;string Insert_map(string str){ for(int i = 0; i < str.size(); i++) { if(str[i] >= 'A' && str[i] <= 'Z') { .
2020-11-22 18:32:08
384
原创 7-4 银行排队问题之单窗口“夹塞”版 (30分)
#include<bits/stdc++.h>#include <string>#include<iostream>using namespace std;struct List{ int is_ture; int start_time;//头指针计总分等待时间 int end_time;//头指针计最长等待时间 int wait_time;//代表服务了多少人 string name; struct List .
2020-11-22 18:30:13
330
操作系统调度高响应比优先
2023-03-20
java Web脚本中变量处理
2022-07-12
java Web中变量处理
2022-07-12
Ubuntu java连接Mysql 失败
2022-07-09
TA创建的收藏夹 TA关注的收藏夹
TA关注的人