
codeup新家
heike000000
这个作者很懒,什么都没留下…
展开
-
完数与盈数(时间复杂度极低的算法)
题目描述 一个数如果恰好等于它的各因子(该数本身除外)子和,如:6=3+2+1,则称其为“完数”; 若因子之和大于该数,则称其为“盈数”。求出2 到60 之间所有“完数”和“盈数”,并以如 下形式输出: E: e1 e2 e3 …(ei 为完数) G: g1 g2 g3 …(gi 为盈数) 输入 无 输出 按描述要求输出(注意EG后面的冒号之后有一个空格)。 如果题目范围为2~n,当n很大时,普通的方法会需要很长时间对因子进行求和。以下算法更好。 ```cpp #include <stdio.h&g原创 2021-02-16 15:25:45 · 328 阅读 · 0 评论 -
codeup
问题 C: To Fill or Not to Fill [命题人 : 外部导入] 时间限制 : 1.000 sec 内存限制 : 32 MB 题目描述 With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time原创 2020-06-15 00:59:03 · 171 阅读 · 0 评论