![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
HDOJ
m0_46608549
这个作者很懒,什么都没留下…
展开
-
HDOJ 1005 Number Sequence(C语言)
刚开始看到题目我第一反应就是直接递归走起,可看到n<=100,000,000后我人傻了,这用递归肯定要爆掉。可峰回路转,题目其实已经给了解决的办法。 我们来看看题目给出的公式: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. 分析: 题目中A,B为常数,由于mod7,所以f(n-1)和f(n-2)的结果范围必定在(0,6)之间,那么问题可以转化为A * f(n - 1) 和 B * f(n - 2)的排列组合,即为7*原创 2020-10-21 10:35:53 · 200 阅读 · 0 评论 -
HDOJ 1004 Let the Balloon Rise(C语言)
其实是很简单的一道题 我的思路是用二维数组存储字符串,随后用strcmp函数确定字符串是否相等,若相等则指针++,同时比较是否大于前一个字符串的出现次数,如果大于,覆写次数和index,最后输出下标为index的字符串,接着清空二维数组。 #include <stdio.h> #include <string.h> int main(void){ char map[10001][20]; int max = 0; int index = 0; int temp = 0; i原创 2020-10-20 18:33:19 · 197 阅读 · 0 评论