plutolove’s diary

I love three things in this world, the sun, the moon and you. The sun for the day, the moon for the night, and you forever。

hiho

hiho-[Offer收割]编程练习赛65-题目4 : 解方程

题目链接:https://hihocoder.com/problemset/problem/1771 题意 设 f(n) 表示 n 的每一位数字的平方之和,求 [a,b] 中有几个 n 满足 k × f(n)=n (1 ≤ k, a, b ≤ 1018,且a ≤ b) 解法 由于f(n)表示每一位数字的平方之和,那么f(n)的范围最大不超过18*9*9,那…

hiho-[Offer收割]编程练习赛65-题目2 : 最长子段

题目链接:https://hihocoder.com/problemset/problem/1769 题意 给定一个数组a[1..n],你需要选一个尽可能长的非空连续子段,使得这个子段的和小于等于给定的一个数 S. 解法 sum[i]数组维护前缀和,mas[i]数组维护以i结尾的最大的sum[i]+S:mas[i] = max(sum…