摘要: 题目地址:https://www.nowcoder.com/acm/contest/136/C dfs找出最长路和次长路,将两个结果相加再加上起点即可; 阅读全文
posted @ 2018-08-22 21:48 liubilan 阅读(197) 评论(0) 推荐(0)
摘要: 给出前几项,求出第n项; 阅读全文
posted @ 2018-08-22 20:50 liubilan 阅读(260) 评论(0) 推荐(0)
摘要: 题目地址:https://www.nowcoder.com/acm/contest/136/J 解法一: 推数学公式求前n项和; 当k=1时,即为等差数列,Sn = n+pn(n−1)/2 当k≠1时,an+p/(k−1) = k(an−1+p/(k-1)),等比数列,Sn = (kn+1+(p−1 阅读全文
posted @ 2018-08-22 20:03 liubilan 阅读(202) 评论(0) 推荐(0)