随笔分类 -  算法基础—递归/递推

摘要:大家都知道 Fibonacci 数列吧,f1=1,f2=1,f3=2,f4=3,…,fn=fn−1+fn−2。 现在问题很简单,输入 n 和 m,求 fn 的前 n 项和 Snmodm。 输入格式 共一行,包含两个整数 n 和 m。 输出格式 输出前 n 项和 Snmodm 的值。 数据范围 1≤n 阅读全文
posted @ 2021-07-10 19:29 脂环 阅读(186) 评论(0) 推荐(0) 编辑
摘要:You are given a string s[1…n]s[1…n] consisting of lowercase Latin letters. It is guaranteed that n=2kn=2k for some integer k≥0k≥0 . The string s[1…n]s 阅读全文
posted @ 2020-07-18 17:09 脂环 阅读(396) 评论(0) 推荐(0) 编辑
摘要:E. Count The Blocks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You wrote down all i 阅读全文
posted @ 2020-03-25 14:07 脂环 阅读(171) 评论(0) 推荐(0) 编辑
摘要:题目描述 对于一个递归函数w(a,b,c)w(a,b,c)w(a,b,c) 如果a≤0a \le 0a≤0 or b≤0b \le 0b≤0 or c≤0c \le 0c≤0就返回值111. 如果a>20a>20a>20 or b>20b>20b>20 or c>20c>20c>20就返回w(20, 阅读全文
posted @ 2020-03-14 20:53 脂环 阅读(331) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩