T1-Curriculum Vitae 给你一个长度为n的01序列a,删去其中的几个数,使得序列中左边是连续的0,右边是连续的1,可以没有0或1,求最多剩下几个数 解法 对于每个点看它左边几个0,右边几个1,弄个前缀和可以O(n),虽然n方也能过QAQ ac代码 #include<bits/stdc++.h> using namespace std; int n,a[110],suml[110],sumr[110],ans=0; int main() { scanf("%d"…
t1-Painting 这道题目比较简单,但是我比较弱就只是写了一个链表合并和区间DP. 别人的贪心吊打我的DP,嘤嘤嘤. #include <bits/stdc++.h> #define ll long long using namespace std; namespace chhokmah { #define N 100005 #define M 5005 int a[N], l[M], r[M], pos[N]; int n, m, cnt; ll sum[M], f[M][M]; ll…
/* The Most Important Things: ljc chat with fyh on QQTa说期末考Ta数学74分感觉不好但是我觉得fyh是地表最强的鸭~~(of course encourge her) About Today's Training: 玄学错误,没有开longlong+没有算好空间(还不如暴力) 还是得继续加油. 本来以为今天是AK局来着呢.. */ Problem A password 求$\sum\limits _{i=1} ^n i^2 2^i$ 的值,…