摘要: 题目链接:http://codeforces.com/problemset/problem/313/C题目意思:给定 4n 个整数(可以组成 2n × 2n 大小的矩阵),问通过对这些整数进行排列,求出 the resulting maximum beauty of the matrix。这个最大值的定义是这样的:先定义m为所有整数中的最大值。如果n = 0,那么,这个beauty 数就是m;否则把2n × 2n 大小的矩阵划分为2n - 1 × 2n - 1- 大小的子矩阵,那么 beauty 数是:m + 其余4个子矩阵的beauty数。 举个例子吧,假设输入 阅读全文
posted @ 2014-01-26 16:49 windysai 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/313/B题目意思:给出一个只有 "." 和 "#" 组成的序列s,问当给定一个区间 [li, ri] 时,si = si + 1(".." 或者 "##")的个数。(li ≤ i 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 1e5 + 10; 8 int cnt[maxn]; 9 10 int main()11 { 阅读全文
posted @ 2014-01-26 16:03 windysai 阅读(256) 评论(0) 推荐(0) 编辑