niithub

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2016年8月24日

摘要: 题目描述 一个数如果恰好等于它的因子之和,这个数就称为"完数"。 例如,6的因子为1、2、3,而6=1+2+3,因此6是"完数"。 编程序找出N之内的所有完数,并按下面格式输出其因子。 输入描述 N 输出描述 ? its factors are ? ? ? 样例 输入: 1000 输出: 6 its 阅读全文
posted @ 2016-08-24 16:40 niithub 阅读(419) 评论(0) 推荐(0) 编辑

摘要: 给定一个升序排列的数组,去掉重复的数,并返回新的数组的长度。 例如: 数组A = {1, 1, 2},你的函数应该返回长度2,新数组为{1, 2} 要求: 不能新开数组分配额外的空间。即常数空间限制。 提示: 输入一个整数n,以及其对应的数组A[n],输出新数组长度 给定一个升序排列的数组,去掉重复 阅读全文
posted @ 2016-08-24 13:55 niithub 阅读(123) 评论(0) 推荐(0) 编辑

摘要: The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 阅读全文
posted @ 2016-08-24 09:50 niithub 阅读(103) 评论(0) 推荐(0) 编辑