构造模拟
wchhlbt
这个作者很懒,什么都没留下…
展开
-
hdu 1431 素数回文 (模拟)
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1431 解题思路:采用构造的思路来构造回文数字,怎么构造呢?首先将回文数分为两类,奇数长度的回文数字和偶数长度的回文数字。 1)对于偶数长度的回文数字,可以由1-n每一个数字将其对称翻转构造 2)对于奇数长度的回文数字,可以在跳过最后数字一位的情况下翻转构造 还有一个事实就是由同一个数字构造原创 2016-10-03 17:26:27 · 567 阅读 · 0 评论 -
哈尔滨理工大学软件学院ACM程序设计全国邀请赛 F Fibonacci Again (矩阵快速幂)
解题思路:解决本题的一个关键就是发现其表达式和原来的斐波那契数列的不同,通过打表分析观察,可以发现一个以6为周期的循环。原创 2016-12-03 19:11:38 · 1003 阅读 · 1 评论 -
codeforces 748D Santa Claus and a Palindrome (构造+贪心+数据结构)
题目大意:给定 n 个字符串,每个字符串有一个价值 val,让你通过这些给定的字符串拼出一个总价值最大的回文串(palindrome)。所有字符串长度相同。 解题思路:总体上是一种贪心的想法。 1、先将所有的字符串尽量两两配对形成回文串,保证每两个字符组成的回文串的总价值大于零。 2、考虑比较特殊的情况,最后形成的回文串中间可以原创 2016-12-26 17:08:27 · 1144 阅读 · 0 评论 -
codeforces 768B (推理+归纳)
题目原文: Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become原创 2017-02-21 17:10:09 · 491 阅读 · 0 评论 -
codeforces 709D Recover the String (构造+模拟)
题目原文: For each string s consisting of characters '0' and '1' one can define four integers a00, a01, a10 and a11, where axy is the number of subsequences of length 2 of the string s eq原创 2017-02-23 13:58:44 · 431 阅读 · 0 评论 -
codeforces 777E Hanoi Factory (栈+贪心)
题目原文:http://codeforces.com/contest/777/problem/E Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful原创 2017-02-25 14:12:57 · 1453 阅读 · 0 评论 -
codeforces 854D Jury Meeting (思维、尺取)
题目原文: http://codeforces.com/problemset/problem/853/B B. Jury Meeting Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should m原创 2017-09-14 20:55:25 · 392 阅读 · 0 评论 -
codeforces 876F High Cry (思维,位运算)
D. High Cry Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :) Rick and Morty like to go to原创 2017-11-01 15:59:50 · 361 阅读 · 0 评论