摘要:"bzoj1 218 激光炸弹" 思路:二维前缀和 cpp include using namespace std; const int N = 5010; int dp[N][N]; int n, r; int main(){ ifdef ONLINE_JUDGE else freopen("in
阅读全文
摘要:HDU 1394 原始序列逆序对为ans,新序列的逆序对减少s[i]个,增加n - (s[i] + 1)个,所以增加的逆序对为ans += n - 1 - 2*s[i];
阅读全文
摘要:"POJ1523 Targin求关节点" Targin求关节点 include include include include using namespace std; const int N = 1010; struct node{ int v, nxt; }edge[2010]; int n,
阅读全文
摘要:"HDU6299" 题意:给n组只包含'('和')'的字符串,求最大的左右括号能匹配的长度 分析:先把所有字符串内能个匹配的左右括号找出来,然后贪心的找出剩下的字符串里面能匹配的个数,怎样才能使匹配的个数最大呢,就是左括号尽量往左放,右括号往右方 include using namespace st
阅读全文