动态规划
知非与非
1900·Lemon:}
展开
-
数位dp(平衡数)
hdu3709 Balanced NumberA balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated原创 2017-08-07 16:50:50 · 446 阅读 · 0 评论 -
概率dp(抓老鼠)
CodeForces - 148D The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the原创 2017-08-09 09:31:06 · 524 阅读 · 0 评论 -
树形dp(校园聚会)
HDU - 1520 There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor re原创 2017-08-09 09:38:10 · 261 阅读 · 0 评论 -
div2之旅001
https://codeforces.com/contest/1082/problem/E题意:n个正数,每个数大小不超过500000。给定c,有一个操作可将任意区间[l,r]之间的所有数同时加减x,只能操作一次,问[1,n]中最多有几个c,输出c的个数。思路:设cnt(l,r,d)表示为[l,r]之间d的个数,即题求max(cnt(1,l-1,c)+cnt(l,r,d)+cnt(r+1,...原创 2018-12-05 20:45:13 · 107 阅读 · 0 评论 -
Codeforces Round #538 (Div. 2)D.Flood Fill
https://codeforces.com/contest/1114/problem/Do(n^2)求最长回文子序列#include<iostream>#include<algorithm>#include<cstring>#include<cmath>using namespace std;typedef long long ...原创 2019-02-11 14:55:37 · 205 阅读 · 0 评论 -
2019牛客暑期多校训练营(第七场)H Pair
题意:给定A、B、C,问1<=x<=A,1<=y<=B,有多少对(x,y)满足x&y>c或x^y<c。思路:考虑约束条件的反面,计算满足x&y<=c并且x^y>=c的对数,数位dp。#include<bits/stdc++.h>using namespace std;typedef long long ll;...原创 2019-08-09 14:34:28 · 152 阅读 · 0 评论