摘要: 题目链接:http://codeforces.com/problemset/problem/327/A 题意是输入一个只有0和1的序列,要求找出一个合理的区间,在这个区间里面把0变成1,1变成0,使得该区间和该区间外的1的个数达到最大。 一开始的的思路是:找最大的0区间(序列中头尾第一次遇到0所夹的区间),然后在这个区间里暴搜(保证该区间内细分到的小区间都搜索过),统计0的个数(由于0会变成1,1自然会变成0,所以没有必要统计1的个数)。但是问题是这样做的话,该区间1的个数和0的个数的多少是不确定的:00 还是 0 == 1。有很多不确定的因素,因此不能保证所找到的0区间是最优的。正确的做.. 阅读全文
posted @ 2013-07-18 17:23 windysai 阅读(510) 评论(0) 推荐(1) 编辑
摘要: 题目链接:http://codeforces.com/problemset/problem/331/C1 这是第一次参加codeforces比赛(ABBYY Cup 3.0 - Finals (online version))成功AC的题目(n ≤ 106),解题的突破口是:Take the magic number, subtract a digit from it (the digit must occur in the number) and get a new magic number. Repeat this operation until a magic number equal. 阅读全文
posted @ 2013-07-18 16:40 windysai 阅读(735) 评论(0) 推荐(0) 编辑