传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1578 [题解] 由于连续买相当于每天买,第二天卖,然后再买.所以每天最后钱尽量多一定是最优的. 所以对于m天,每天做一次O(n*70w)的完全背包dp即可. # include <stdio.h> # include <string.h> # include <iostream> # include <algorithm> // # include &…
第n天不卖,视为卖了又原价买回 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define R(a,b,c) for(register int a = (b); a <= (c); ++ a) #define nR(a,b,c) for(register int a = (b); a >=…