笔记
文章平均质量分 58
看到我你要笑一下
笑口常开(σ′▽‵)′▽‵)σ
展开
-
visual studio输入!没有提示
感叹号被弃用了。原创 2022-07-18 08:26:31 · 883 阅读 · 1 评论 -
全排列-next_permutation()
next_permutation 产生全排列非常强大;做一些暴力排序的题挺适用的。它会对当前数组进行从小到大的全排列,所以一般要配合sort()函数使用。当当前序列不存在下一个排列时,函数返回false,否则返回true例子:#include <iostream> #include <algorithm> using namespace std; int main() { int num[3]={0,1,2,3}; do原创 2022-04-11 11:28:58 · 200 阅读 · 0 评论 -
P1650 田忌赛马
题目传送门分析:可DP 可 贪心。DP:思路:如果田忌剩下的马中最强的马都赢不了齐王剩下的最强的马,那么应该用最差的一匹马去输给齐王最强的马。如果田忌剩下的马中最强的马可以赢齐王剩下的最强的马,那就用这匹马去赢齐王剩下的最强的马。如果田忌剩下的马中最强的马和齐王剩下的最强的马打平的话,可以选择打平或者用最差的马输掉比赛。状态转移方程:设f[i,j]表示齐王按从强到弱的顺序出马和田忌进行了i场比赛之后,从“头”取了j匹较强的马,从“尾”取了i-j匹较弱的马,所能够得到的最大盈利。状态转移方程原创 2022-03-30 10:17:49 · 151 阅读 · 0 评论 -
一个国家选民选票
In one of the countries of Caribbean basin all decisions were accepted by the simple majority of votes at the general meeting of citizens (fortunately, there were no lots of them). One of the local parties, aspiring to come to power as lawfully as possible原创 2021-03-18 22:26:27 · 144 阅读 · 1 评论 -
Farmer John 的泥潭
Farmer John has a problem: the dirt road from his farm to town has suffered in the recent rainstorms and now contains (1 <= N <= 10,000) mud pools.Farmer John has a collection of wooden planks of length L that he can use to bridge these mud pools. H原创 2021-03-14 13:09:27 · 192 阅读 · 0 评论 -
Farmer John‘s cows 简单题解
Farmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are making too much noise.FJ’s N cows (1 <= N <= 10,000)all graze at various locations on a long one-dimensional pasture. The cows are very chatty anima原创 2021-03-12 13:13:32 · 1246 阅读 · 2 评论