DP
我是一位爱编程的蒟蒻
我是一位爱编程的蒟蒻
展开
-
Sitting In The Line(百度之星初赛, 超能力Coding 4370)
#include <iostream>#include <cstdio>using namespace std;int a[100010];int p[29];int dp[1 << 20][20];int b[29];const int inf = 1500000000;void checkmax(int & a, const int & b){ if(b > a) a = b;}int main(){原创 2022-03-31 17:53:47 · 63 阅读 · 0 评论 -
TSP问题
TSP问题 (POJ3311/HDU5067/HDU5418/HDU1217)采用 POJ3311POJ3311POJ3311 的题面DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the原创 2022-03-31 17:25:30 · 116 阅读 · 0 评论 -
SP1437
【树形DP学习笔记】【模板题】树的直径**题目简述:**给定一棵树,有 nnn 个点和 n−1n-1n−1 条边,求这棵树上的任意两个点的距离的最大值。2≤n≤1052\le n\le 10^52≤n≤105,1≤ai<bi≤n1\le a_i < b_i\le n1≤ai<bi≤n,1≤ci≤1041\le c_i\le 10^41≤ci≤104题解:任取一点 uuu 作为起点,找到距离这个点的最短的一个点 v1v_1v1。找到距离 v1v_1v1 最远的一个点 v2原创 2022-03-17 16:50:11 · 90 阅读 · 0 评论 -
CodeForces 176B
#include <bits/stdc++.h>using namespace std;int dp[5555][5555];signed main() { int n__; cin >> n__; string s; cin >> s; string t = s; reverse (t.begin(), t.end()); int n = s.length(); for (int i = n;原创 2022-03-16 17:05:26 · 68 阅读 · 0 评论 -
P5842
#include <iostream>#include <cstdio>#include <cstring>#define int long long // QAQ_QWQusing namespace std;const int MOD = 20120427, isoprene_jvruoMOD = 1000037, N = 66062;#define ll long longint head[isoprene_jvruoMOD + 50], n原创 2022-03-15 17:45:05 · 72 阅读 · 0 评论 -
P3413
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int mod = 1000000007;long long f[10030][2][10][10][2];int n = 0, c[10030];long long calc(long long x) { // int n = 0; // int c[30] {};原创 2022-03-10 17:39:36 · 195 阅读 · 0 评论 -
SP10790
// usename: lxylluvio// Date: 2022/03/09 10:06// Remote Judge from Luogu.#include <iostream>#include <cstring>#include <cstdio>#define st(f,x) memset (f, x, sizeof f);using namespace std;bool b[210];inline void sieve(bool *a原创 2022-03-09 10:11:15 · 52 阅读 · 0 评论