题目链接https://loj.ac/problem/6277 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 typedef long long ll; 5 const int maxn = 1e5 + 10; 6 const int in ...
分类:
其他好文 时间:
2020-08-08 21:23:31
阅读次数:
77
A Very Easy Graph Problem 题解:首先根据\(2^{i}\)的特殊性,我们可以发现最短路其实就是最小生成树上的路,那么我们就可以先把图换成最小生成树;然后我们看一条边要经过几次,就是要看一条边对答案的贡献:某一条边被遍历的次数必定是这条边下面的所有权值1的点的个数 * 这条边 ...
分类:
其他好文 时间:
2020-08-08 21:19:30
阅读次数:
82
题意:n段木棍,每个长度为a[i],求切割K次后,使得的最长的木棍长度最短,输出此时最长的木棍长度。n<2e5,k<1e9 题解:切割次数越多,切割后的长度越短,满足单调性,可二分切割后,最长的木棍不大于多少,check判断切割次数是否小于K次即可。 #include <bits/stdc++.h> ...
分类:
其他好文 时间:
2020-08-08 11:47:52
阅读次数:
81
题意: 分析: 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod=1e9+7; const int N=1e6+6; int mu[N]; int prime[N],cnt; b ...
分类:
其他好文 时间:
2020-08-07 12:39:20
阅读次数:
82
#include<bits/stdc++.h> using namespace std; const int maxn=200; typedef long long ll; const ll mod=998244353; ll pow_m (ll a,ll b,ll mod) { ll res=1; ...
分类:
其他好文 时间:
2020-08-06 20:40:43
阅读次数:
59
链接:https://leetcode-cn.com/problems/word-break/ 代码 /* * @lc app=leetcode.cn id=139 lang=cpp * * [139] 单词拆分 */ // @lc code=start class Solution { publi ...
分类:
其他好文 时间:
2020-08-03 23:33:50
阅读次数:
84
题目链接:https://www.acwing.com/video/864/ 给定一个长度为n的序列,问将这个序列分成连续的若干段,每段不超过M的情况下,每段的最大值之和最小是多少? 如果数据范围比较小的话就可以不进行任何优化,用dp[i]表示将[1,i]分成若干段满足条件的情况下每段最大值最小的情 ...
分类:
编程语言 时间:
2020-08-03 12:20:53
阅读次数:
74
1495:【例 2】孤岛营救问题 分层最短路做。以获取钥匙的状态建立分层图,然后BFS就行了 https://blog.csdn.net/a_pathfinder/article/details/100537489 里面写了BFS+状压 和 最短路得解法 like 汽车加油行驶问题(另一个分层图的问 ...
分类:
其他好文 时间:
2020-07-31 19:25:44
阅读次数:
96
节点的结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 基本功能和操作演示 #include <stdio.h> #include <stdlib.h> struct Node { int valu ...
分类:
编程语言 时间:
2020-07-30 22:10:51
阅读次数:
73
节点的数据结构 struct Node { int value; struct Node* next; }; typedef struct Node Node; 操作和演示 #include <stdlib.h> #include <stdio.h> // 建立一个节点 Node *createNo ...
分类:
编程语言 时间:
2020-07-30 01:18:43
阅读次数:
82