- 博客(7)
- 收藏
- 关注
原创 洛谷P1807[已解决] 动态规划
78#include<cstdio>#include<cstring>#include<vector>#include<algorithm>using namespace std;const int maxn = 1505;struct Node { int w; int v; Node(int _v,int _w):v(_v),w(_w){}};vector<Node> Adj[maxn];int n;int dp[
2021-04-26 20:15:24
118
原创 hdu 1024 Max Sum Plus Plus
#include<cstdio>#include<algorithm>#include<cstring>using namespace std;const int maxn = 1000010;int dp[maxn];int num[maxn];int premax[maxn];int main() { int n, m; while (scanf("%d %d", &m, &n) != EOF) { for (int i = 1
2021-04-16 17:58:16
86
原创 POJ 1521 哈夫曼编码
#include<cstdio>#include<queue>#include<algorithm>#include<string>#include<iostream>using namespace std;priority_queue<int, vector<int>, greater <int> > Q;int main() { string s; while (getline(ci
2021-04-13 16:31:44
205
原创 HJ6 质数因子
题目描述功能:输入一个正整数,按照从小到大的顺序输出它的所有质因子(重复的也要列举)(如180的质因子为2 2 3 3 5 )最后一个数后面也要有空格#include<cstdio>#include<iostream>#include<math.h>using namespace std;const int maxn = 100000;int prime[maxn];//int time[maxn] = { 0 };bool isPrime(int n
2021-04-11 22:08:17
107
原创 问题 A: 通信系统
问题 A: 通信系统#include<cstdio>#include<algorithm>const int maxn = 10010;int father[maxn];bool isRoot[maxn];void Init(int n) { for (int i = 1; i <= n; i++) { father[i] = i; isRoot[i] = false; }}int getfather(int x) { int a = x; w
2021-04-10 16:18:03
145
原创 算法笔记》9.5小节——数据结构专题(2)->平衡二叉树(AVL)
《算法笔记》9.5小节——数据结构专题(2)->平衡二叉树(AVL)#include<cstdio>#include<math.h>#include<algorithm>using namespace std;struct node { int data,height; node* lchild; node* rchild;};node* newNode(int v) { node* Node = new node; Node->da
2021-04-10 15:55:00
89
原创 [未解决]算法笔记 问题 E: 【宽搜入门】巧妙取量
自己测试都是对的,提交答案错误,目前还未解决#include#include#include#includeusing namespace std;int cap3;map<int, bool> mp;int endnum;int src[6] = { 0,0,1,1,2,2 };int tar[6] = { 1,2,0,2,0,1 };struct node {int a;int b;int c;int step;};void pour(int target,
2021-04-06 17:38:41
115
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人