1.链接地址:

http://poj.org/problem?id=1316

http://bailian.openjudge.cn/practice/1316

2.题目:

总时间限制:
1000ms
内存限制:
65536kB
描述
In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for digitadition, a term coined by Kaprekar.) For example, d(75) = 75 + 7 + 5 = 87. Given any positive integer n as a starting point, you can construct the infinite increasing sequence of integers n, d(n), d(d(n)), d(d(d(n))), .... For example, if you start with 33, the next number is 33 + 3 + 3 = 39, the next is 39 + 3 + 9 = 51, the next is 51 + 5 + 1 = 57, and so you generate the sequence

33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, ...
The
number n is called a generator of d(n). In the sequence above, 33 is a
generator of 39, 39 is a generator of 51, 51 is a generator of 57, and
so on. Some numbers have more than one generator: for example, 101 has
two generators, 91 and 100. A number with no generators is a
self-number. There are thirteen self-numbers less than 100: 1, 3, 5, 7,
9, 20, 31, 42, 53, 64, 75, 86, and 97.

输入
No input for this problem.
输出
Write a program to output all positive self-numbers less than 10000 in increasing order, one per line.
样例输入
样例输出
1
3
5
7
9
20
31
42
53
64
|
| <-- a lot more numbers
|
9903
9914
9925
9927
9938
9949
9960
9971
9982
9993
来源
Mid-Central USA 1998

3.思路:

4.代码:

 //2010-04-28
//v0.1 create by wuzhihui
#include<iostream>
using namespace std;
#define max 10000
int a[max+]={}; int main()
{
int b,c;
int i;
//memset(a,1,sizeof(a));
for(i=;i<=max;i++)
{
b=c=i;
do
{
b+=(c%);
c=c/;
}while(c!=);
if(b<=max) a[b]=;
}
for(i=;i<=max;i++)
{
if(a[i]==) cout<<i<<endl;
}
//system("pause");
return ;
}

OpenJudge/Poj 1316 Self Numbers的更多相关文章

  1. Poj 1316 Self Numbers(水题)

    一.Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called se ...

  2. Poj 2247 Humble Numbers(求只能被2,3,5, 7 整除的数)

    一.题目大意 本题要求写出前5482个仅能被2,3,5, 7 整除的数. 二.题解 这道题从本质上和Poj 1338 Ugly Numbers(数学推导)是一样的原理,只需要在原来的基础上加上7的运算 ...

  3. OpenJudge/Poj 2105 IP Address

    1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...

  4. OpenJudge/Poj 1915 Knight Moves

    1.链接地址: http://bailian.openjudge.cn/practice/1915 http://poj.org/problem?id=1915 2.题目: 总Time Limit: ...

  5. OpenJudge/Poj 1163 The Triangle

    1.链接地址: http://bailian.openjudge.cn/practice/1163 http://poj.org/problem?id=1163 2.题目: 总时间限制: 1000ms ...

  6. OpenJudge/Poj 1844 Sum

    1.链接地址: http://bailian.openjudge.cn/practice/1844 http://poj.org/problem?id=1844 2.题目: Sum Time Limi ...

  7. OpenJudge/Poj 1979 Red and Black / OpenJudge 2816 红与黑

    1.链接地址: http://bailian.openjudge.cn/practice/1979 http://poj.org/problem?id=1979 2.题目: 总时间限制: 1000ms ...

  8. OpenJudge/Poj 1207 The 3n + 1 problem

    1.链接地址: http://bailian.openjudge.cn/practice/1207/ http://poj.org/problem?id=1207 2.题目: 总时间限制: 1000m ...

  9. OpenJudge/Poj 1005 I Think I Need a Houseboat

    1.链接地址: http://bailian.openjudge.cn/practice/1005/ http://poj.org/problem?id=1005 2.题目: I Think I Ne ...

随机推荐

  1. fastjson使用示例

    一.fastjson 一款Json处理工具包,包括“序列化”和“反序列化”两部分,它具备如下特征:速度最快,测试表明,fastjson具有极快的性能,超越任其他的Java Json parser.包括 ...

  2. UIView的Touch事件UIControlEvents详解

    首先,UIControlEvents有这个几种: UIControlEventTouchDown = << , // on all touch downs UIControlEventTo ...

  3. 开源企业IM,免费企业即时通讯软件-ENTBOOST云通讯平台Windows(r174)版本号公布

    经过恩布团队全体成员的不懈努力,依照原定计划,最终在今天(5月14日)公布第二个开源版本号,恩布企业互联IM,ENTBOOST 0.2.0(r174beta)Windows版本号:主要功能支持文本.表 ...

  4. 征服 Nginx + Tomcat

    2年前一直折腾Apache,现如今更习惯Nginx. 搭建网站又遇到2年前遇到的问题——Session同步. (参考我以前的帖子——征服 Apache + Tomcat)只不过现今担当负载均衡的Apa ...

  5. POJ 1329 三角外接圆

    Circle Through Three Points Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3169   Acce ...

  6. 9个使用前必须再三小心的Linux命令

      Linux shell/terminal 命令非常强大,即使一个简单的命令就可能导致文件夹.文件或者路径文件夹等被删除.在一些情况下,Linux 甚至不会询问你而直接执行命令,导致你丢失各种数据信 ...

  7. TIME-WAIT和CLOSE-WAIT

    系统调优,你所不知道的TIME_WAIT和CLOSE_WAIT 2016-03-11 运维帮 来源微信订阅号:大房说 作者:大房 你遇到过TIME_WAIT的问题吗?   我相信很多都遇到过这个问题. ...

  8. 应聘.net开发工程师常见的面试题(一)(转载)

    1. 简述 private. protected. public. internal 修饰符的访问权限. 答 . private : 私有成员, 在类的内部才可以访问. protected : 保护成 ...

  9. 深入研究Block捕获外部变量和__block实现原理

    Blocks是C语言的扩充功能,而Apple 在OS X Snow Leopard 和 iOS 4中引入了这个新功能“Blocks”.从那开始,Block就出现在iOS和Mac系统各个API中,并被大 ...

  10. mysql与java的之间的连接

    package cn.hncu; //注意,以下都是sun公司的接口(类)---这样以后换成Oracle等其它数据库,代码不用动import java.sql.Connection;import ja ...